T09 · Insecure Skill Coding Practices
- Location
billing.py:17- Finding
Hardcoded SkillPay API Credential Is Used as a Runtime Fallback
- Content
View full analysis
dict: return { "X-API-Key": os.environ.get("SKILL_BILLING_API_KEY", API_KEY), "Content-Type": "application/json", } ``` ### Technical Analysis A live-looking SkillPay API key is embedded directly in the source code as the fallback value for `SKILL_BILLING_API_KEY`. If the environment variable is absent, `_get_headers()` automatically places this credential in the `X-API-Key` header of requests sent to the SkillPay billing service. Secrets committed to source code should be treated as compromised because anyone with access to the project package, repository history, deployment image, or distributed Skill can retrieve them. The environment-variable override does not mitigate exposure of the committed fallback value. ### Attack Path 1. An attacker downloads or otherwise obtains the Skill source package. 2. The attacker reads `billing.py` and extracts the embedded API key and Skill ID. 3. The attacker submits direct requests to the documented SkillPay billing endpoints using the exposed value in the `X-API-Key` header. 4. Any billing capabilities granted to that credential may be exercised outside the intended Skill deployment. 5. Requests made with the shared credential become difficult to attribute to the legitimate deployment versus an attacker. ### Impact Assessment The attacker may obtain the billing-service privileges assigned to the exposed API key. Depending on server-side authorization enforced by SkillPay, this could include querying billing information, generating payment link ...[truncated 272 chars]- Remediation
View remediation
