T09 · Insecure Skill Coding Practices
Error
- Location
- research.sh:12
- Finding
- Hardcoded Brave Search API Credential<![CDATA[ ## Vulnerability Details **File Location**: `research.sh:12` **Vulnerability Type**: Hardcoded API credential **Risk Level**: High ### Vulnerable Code ```bash BRAVE_API_KEY="${BRAVE_API_KEY:-BSAfZrm_28TmR5FM9FhMCrTA1A3zS2n}" ``` ### Technical Analysis The script embeds a plausible Brave Search subscription token and uses it whenever `BRAVE_API_KEY` is not explicitly supplied. Secrets committed to source code must be considered compromised because every recipient of the package can extract and reuse them. The environment-variable override does not mitigate the exposure: the embedded token remains present in every distributed copy and in source-control history. ### Attack Path 1. An attacker obtains or downloads the Skill package. 2. The attacker reads `research.sh` without needing to execute it. 3. The attacker extracts the embedded subscription token. 4. The attacker submits requests directly to the Brave Search API using that token. 5. Requests consume the credential owner's quota and may create billing or service-availability consequences. ### Impact Assessment An attacker can obtain unauthorized access to the Brave Search subscription represented by the credential. The practical scope includes unauthorized API calls, quota exhaustion, billing impact, rate-limit exhaustion, and possible suspension of the associated service account. This finding does not establish access to the host system itself. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed Brave API token immediately. 2. Remove the default credential from the source code and repository history. 3. Require `BRAVE_API_KEY` to be supplied through an approved secret manager or protected environment injection. 4. Fail closed with a clear error if the credential is absent: ```bash : "${BRAVE_API_KEY:?BRAVE_API_KEY must be supplied through secure configuration}" ``` 5. Add automated secret scanning to pre-commit hooks and CI. 6. Restrict replacement credentials by quota, permitted API, and environment where the provider supports those controls. ]]>
