T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/daily-news.sh:12
- Finding
- Hard-Coded Tavily API Credential<![CDATA[ ## Vulnerability Details **File Location**: `scripts/daily-news.sh:12`, used at `scripts/daily-news.sh:38-40`, `55-57`, and `72-74` **Vulnerability Type**: Hard-coded secret **Risk Level**: High ### Vulnerable Code ```bash TAVILY_API_KEY="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" ``` The credential is subsequently embedded in three requests: ```bash -d "{\"api_key\": \"$TAVILY_API_KEY\", ...}" ``` ### Technical Analysis A live-format Tavily API key is stored directly in a distributable shell script. Anyone who can download, inspect, fork, or access the Skill package can recover the credential without authentication. Although HTTPS protects the credential in transit, it does not mitigate disclosure through the source package. Sending the key in request bodies also means it may appear in debugging output, HTTP traces, or process instrumentation. ### Attack Path 1. An attacker downloads or otherwise obtains the Skill package. 2. The attacker opens `scripts/daily-news.sh`. 3. The attacker extracts the hard-coded Tavily API key. 4. The attacker submits arbitrary requests to the Tavily API using that key. 5. Requests consume the credential owner's quota and may create financial or operational consequences. ### Impact Assessment An attacker gains access to the Tavily API under the authority associated with the exposed key. The practical scope is limited by the permissions and quota assigned to that credential, but may include: - Unauthorized API usage - Quota exhaustion - Unexpected billing - Service disruption for the legitimate owner - Abuse attributed to the credential owner ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed API key immediately. 2. Remove the credential from the repository and published package history. 3. Load the credential from a protected environment variable: ```bash : "${TAVILY_API_KEY:?TAVILY_API_KEY must be configured}" ``` 4. Prefer a secret manager or protected OpenClaw credential facility instead of plaintext files. 5. Ensure secret files are excluded from version control and created with owner-only permissions. 6. Add automated secret scanning to release and CI workflows. 7. Restrict the replacement credential to the minimum required API permissions and quota. ]]>
