T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/process_tagged.sh:90
- Finding
- Hard-Coded Tenor API Credential<![CDATA[ ## Vulnerability Details **File Location**: `scripts/process_tagged.sh:90-95` **Vulnerability Type**: Hard-coded API credential **Risk Level**: Medium ### Vulnerable Code ```bash GIF_URL=$(curl -s "https://tenor.googleapis.com/v2/search?q=$(python3 -c "import urllib.parse,sys; print(urllib.parse.quote(sys.argv[1]))" "$QUERY")&key=AIzaSyAyimkuYQYF_FXVALexPuGQctUWRURdCYQ&limit=1" 2>/dev/null | python3 -c " import sys, json data = json.load(sys.stdin) results = data.get('results', []) if results: print(results[0].get('media_formats', {}).get('gif', {}).get('url', '')) " 2>/dev/null || echo "") ``` ### Technical Analysis The script embeds a Google/Tenor API key directly in distributed source code. Anyone with access to the package can extract and reuse this credential independently of the Skill. Client-distributed API keys should be treated as publicly exposed unless they are tightly restricted at the provider. The available source does not establish that this key has API, referrer, application, billing, or quota restrictions. Although the key is not a Bear token and does not directly grant access to local notes, its exposure creates credential-abuse and operational risks. ### Attack Path 1. An attacker downloads or inspects the Skill package. 2. The attacker extracts the API key from line 90. 3. The attacker submits unrelated requests to compatible Google APIs using that key. 4. If provider-side restrictions are insufficient, the requests consume the owner's quota or generate charges and abuse attributed to the key owner. 5. Sustained misuse may cause service degradation or revocation of the key, breaking GIF lookup for legitimate users. ### Impact Assessment The exposed key does not provide local shell privileges or access to the Bear token based on the audited code. Its scope is limited to permissions granted to the Google API project. Potential consequences include unauthorized API usage, quota exhaustion, billing impact, service interruptio ...[truncated 69 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed API key immediately. 2. Remove the credential from source code and repository history. 3. Read the credential from a protected environment variable or secret manager, for example: ```bash : "${TENOR_API_KEY:?TENOR_API_KEY must be configured}" ``` 4. Restrict the replacement key to the minimum required Tenor API, with conservative quotas and billing alerts. 5. Apply every provider-supported application, source, IP, or referrer restriction compatible with the deployment model. 6. Avoid printing the key in logs or command diagnostics. 7. Fail safely with a clear configuration error when no key is supplied. ]]>
