T09 · Insecure Skill Coding Practices
- Location
scripts/run.js:18- Finding
Hard-Coded Billing API Credential
- Content
View full analysis
null); } async function charge() { const r = await fetch(`${BILLING_URL}/charge`, { method: 'POST', headers: { 'content-type': 'application/json', 'x-api-key': API_KEY }, body: JSON.stringify({ user_id: userId, skill_id: SKILL_ID, amount: PRICE }), }).catch(() => null); } ``` ### Technical Analysis The source code contains a live-looking SkillPay API key as the fallback value when `SKILL_BILLING_API_KEY` is not configured. Because the Skill package is distributed to users, anyone who can read the script can recover this credential. The key is subsequently sent in the `x-api-key` header to the configured billing service. Environment-based override support does not protect the embedded fallback secret. The configurable billing URL also means the embedded credential may be transmitted to an operator-controlled endpoint if `SKILLPAY_BILLING_URL` is changed. ### Attack Path 1. An attacker downloads or otherwise reads the Skill package. 2. The attacker extracts the hard-coded `sk_...` credential from `scripts/run.js`. 3. T ...[truncated 985 chars]- Remediation
View remediation
