T09 · Insecure Skill Coding Practices
- Location
lib/billing.ts:6- Finding
Hardcoded Billing API Credential Distributed in Source Code
- Content
View full analysis
{ const resp = await fetch( `${BILLING_API_URL}/api/v1/billing/balance?user_id=${encodeURIComponent(userId)}`, { headers: { 'X-API-Key': BILLING_API_KEY } } ); ``` The credential value is redacted from this report to prevent further disclosure. The repository contains the complete plaintext value. ### Technical Analysis A live-looking billing credential is embedded directly in distributed source code and sent in the `X-API-Key` header by all billing operations. Client-side or locally distributed code cannot protect a shared API secret: any user who downloads the project can inspect the file and recover it. The same credential is also used by `chargeUser` and `getPaymentLink`, meaning its exposure affects multiple billing endpoints. Source-code deletion alone would not invalidate copies in package archives, repository history, build artifacts, terminal logs, or existing installations. ### Attack Path 1. An attacker obtains the source package or repository. 2. The attacker reads `lib/billing.ts` and extracts the plaintext billing credential. 3. The attacker constructs requests to the documented `skillpay.me` billing endpoints using the exposed `X-API-Key`. 4. The attacker can attempt any operation authorized to that credential, including billing-related requests. 5. Activity may be attributed to the legitimate Skill integration. ### Impact Assessment The attacker obtains the billing API privileges assigned to the exposed credential. The exact server-side authorization scope cannot be established from the local project, but potential consequ ...[truncated 173 chars]- Remediation
View remediation
