T09 · Insecure Skill Coding Practices
- Location
scripts/billing.py:17- Finding
Hard-Coded Billing API Credential
- Content
View full analysis
Vulnerability Details
File Location:
scripts/billing.py:17
Vulnerability Type: Hard-coded secret in source code
Risk Level: Highpython API_KEY = os.environ.get("SKILL_BILLING_API_KEY", "sk_91dc212149c7ee3184de119159a89a3a432455bfbfb1d87cf3f3db4b8764ab0c")Technical Analysis
The billing module contains a live-looking API key as the default value when
SKILL_BILLING_API_KEYis absent. Anyone who can download or inspect the skill package can recover this credential. Although the source comments describe the key as charge-only, its actual server-side permissions cannot be verified from the repository.The documentation compounds the issue by directing users to configure
SKILLPAY_API_KEY, while the implementation readsSKILL_BILLING_API_KEY. Consequently, a user who follows the documented setup will not override the embedded credential, and billing calls will silently use the exposed fallback.Attack Path
- An attacker downloads or otherwise obtains the publicly distributed skill package.
- The attacker inspects
scripts/billing.pyand extracts the fallback API key. - The attacker submits requests to the documented SkillPay billing endpoints using the recovered key in the
X-API-Keyheader. - The requests execute with whatever permissions SkillPay assigned to that credential, potentially allowing unauthorized billing operations, publisher impersonation, or quota consumption.
- Because legitimate installations also default to the same credential, abuse may be difficult to distinguish from expected skill traffic.
Impact Assessment
The exposed credential can be reused outside the skill without local privilege escalation. The affected scope includes the associated SkillPay publisher or skill billing identity and any operations authorized to this API key. Potential consequences include unauthorized charge requests, service or quota abuse, attribution of attacker traffic to the publi ...[truncated 224 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed API key through the SkillPay provider.
- Remove the hard-coded fallback and require the credential to be supplied securely:
python API_KEY = os.environ.get("SKILL_BILLING_API_KEY") if not API_KEY: raise RuntimeError("SKILL_BILLING_API_KEY is required") - Correct
SKILL.mdandREADME.mdso that they consistently documentSKILL_BILLING_API_KEY. - Prefer keeping publisher credentials on a controlled backend. The distributed skill should call that backend using a narrowly scoped user or installation token rather than shipping a publisher credential.
- Restrict the replacement key to only the required endpoint and skill identifier, with rate limits, expiration, rotation, and audit logging.
- Review provider logs for unauthorized use of the exposed key and invalidate any related sessions or derived credentials.
- Add secret scanning to CI and release checks to prevent credentials from entering future packages.
