T09 · Insecure Skill Coding Practices
Error
- Location
- skill.json:15
- Finding
- Hard-Coded SkillPay API Credential Distributed with the Project<![CDATA[ ## Vulnerability Details **File Location**: `skill.json:15`; duplicate credential in `README.md:103-106` **Vulnerability Type**: Hard-coded secret exposure **Risk Level**: High ### Vulnerable Code `skill.json:15`: ```json "apiKey": "sk_e390b52cb259fc4f4aa1489547a48375d72876acdee75de57101d9e0e833fcb7", ``` `README.md:103-106`: ```env # SkillPay API Key (Required) SKILLPAY_API_KEY=sk_e390b52cb259fc4f4aa1489547a48375d72876acdee75de57101d9e0e833fcb7 ``` The credential is subsequently used as a bearer token in `src/payment.js:26-29`: ```javascript headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' } ``` ### Technical Analysis A SkillPay API key is committed directly to both machine-readable metadata and public-facing documentation. Anyone who downloads, clones, installs, or otherwise obtains the project receives the same credential. Unlike a placeholder, the value has the format of an actual secret and the documentation instructs users to assign it to `SKILLPAY_API_KEY`. The application then transmits that value as a bearer credential to the SkillPay API. Bearer credentials provide access to any party possessing the token, without proving the identity of the original owner. If the credential remains valid, source-code removal alone is insufficient because copies may persist in package archives, repository history, caches, logs, and forks. ### Attack Path 1. An attacker downloads the Skill package or reads its repository. 2. The attacker extracts the `sk_e390...fcb7` value from `skill.json` or `README.md`. 3. The attacker uses the key as a bearer credential when sending requests to supported SkillPay endpoints. 4. Requests are attributed to the credential owner rather than the attacker. 5. Depending on the provider-side permissions assigned to the key, the attacker may generate unauthorized usage, manipulate payment-related operations, consume quotas, or interfere with analytics. ### Impact Assessment I ...[truncated 612 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke the exposed SkillPay API key immediately and issue a replacement. 2. Investigate provider logs for unauthorized activity performed with the exposed key. 3. Remove the credential from `skill.json`, `README.md`, package archives, release artifacts, and repository history. 4. Replace documentation values with an unmistakable placeholder: ```env SKILLPAY_API_KEY=your_skillpay_api_key ``` 5. Inject the real secret only at deployment time through a secret manager or protected environment variable. 6. Give the replacement key only the minimum provider-side permissions required for payment verification and usage logging. 7. Use separate keys for development, testing, and production. 8. Add automated secret scanning to CI and pre-commit checks. 9. Fail startup securely when payment-dependent functionality is enabled without a valid runtime credential; do not ship a shared fallback key. ]]>
