T09 · Insecure Skill Coding Practices
- Location
billing.py:8- Finding
Hardcoded SkillPay API Credential Exposed in Source Code
- Content
View full analysis
Vulnerability Details
File Location:
billing.py:7-8, with credential use atbilling.py:14,billing.py:30-35, andbilling.py:59-64
Vulnerability Type: Hardcoded secret and reusable API credential
Risk Level: HighVulnerable Code
python BILLING_API_URL = "https://skillpay.me" BILLING_API_KEY = "sk_0c57911690182c45404f945f2908a9e2e32ed448055895ac02227856eaf226ad" SKILL_ID = "6a3b1843-5266-40c6-8f0c-408512bb6f43"The credential is attached to multiple requests:
python headers = {"X-API-Key": BILLING_API_KEY}python headers = { "X-API-Key": BILLING_API_KEY, "Content-Type": "application/json" }Technical Analysis
A credential that appears to be a live SkillPay API key is embedded directly in the distributed Python source. Any party able to download, inspect, or execute the Skill can recover the key without authentication.
The key is reused for balance queries, user charges, and payment-link creation. Although billing is part of the functionality declared in
SKILL.md, distributing a reusable billing credential to every installation is not necessary and violates least-secret-exposure practices. The monitor should obtain a narrowly scoped credential at deployment or use a trusted server-side billing broker.Whether the exposed key permits access outside the configured Skill depends on SkillPay's server-side authorization. Client-side constants such as
SKILL_IDdo not provide a security boundary because an attacker can modify them.Attack Path
- An attacker downloads or otherwise gains read access to the Skill package.
- The attacker opens
billing.pyand extractsBILLING_API_KEY. - The attacker sends independent HTTPS requests to the documented SkillPay endpoints with the extracted key in the
X-API-Keyheader. - The attacker attempts balance queries, payment-link generation, or charge operations for chosen user identifiers.
...[truncated 707 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed API key immediately; removing it from a later revision does not invalidate copies already distributed.
- Remove all credentials from source code and repository history.
- Load deployment secrets from a managed secret store or a protected environment variable.
- Prefer short-lived, narrowly scoped tokens instead of a reusable account-level key.
- Restrict the credential server-side to the required Skill, endpoints, amount limits, and expected caller identity.
- Require independent server-side authorization for each user and charge; never treat possession of the API key alone as authorization.
- Add rate limits, transaction limits, replay protection, audit logging, and anomaly alerts to billing operations.
- Add automated secret scanning to development and release pipelines.
