T09 · Insecure Skill Coding Practices
- Location
payment.py:11- Finding
Hard-Coded SkillPay Bearer Credential Exposed in Source Code
- Content
View full analysis
Vulnerability Details
File Location:
payment.py:11-13, with credential use atpayment.py:24-40andpayment.py:64-74
Vulnerability Type: Hard-coded authentication secret
Risk Level: HighVulnerable Code
python # SkillPay API configuration SKILLPAY_API_KEY = "[REDACTED HARDCODED sk_ CREDENTIAL]" SKILLPAY_BASE_URL = "https://api.skillpay.io/v1" SKILL_SLUG = "shenmeng-lottery-predictor"The credential is subsequently placed into outbound authorization headers:
python headers = { "Authorization": f"Bearer {SKILLPAY_API_KEY}", "Content-Type": "application/json" } data = { "skill_slug": SKILL_SLUG, "price": PRICE_PER_CALL } response = requests.post( f"{SKILLPAY_BASE_URL}/verify", headers=headers, json=data, timeout=10 )It is also used by the balance request:
python headers = { "Authorization": f"Bearer {SKILLPAY_API_KEY}", "Content-Type": "application/json" } response = requests.get( f"{SKILLPAY_BASE_URL}/balance", headers=headers, timeout=10 )The credential value is redacted from this report to avoid further disclosure. The audited source contains the complete plaintext bearer token.
Technical Analysis
A static bearer credential is embedded directly in a distributable source file. Anyone who can download, inspect, archive, or fork the Skill can recover the token without executing the code. Because bearer authentication treats possession of the token as proof of authority, an attacker can submit authenticated requests independently of the Skill.
Sending an authentication token to the intended API over HTTPS may be necessary for payment verification, but distributing a shared secret with the package is not necessary and violates least-secret and credential-lifecycle practices. The lottery-analysis functionality itself operates locally and does not require this credential ...[truncated 1586 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed SkillPay credential.
- Remove the token from source code, package history, release archives, examples, and test fixtures.
- Load credentials from a protected environment variable or secrets manager:
python SKILLPAY_API_KEY = os.environ.get("SKILLPAY_API_KEY") if not SKILLPAY_API_KEY: raise RuntimeError("SKILLPAY_API_KEY is not configured") - Prefer short-lived, per-installation or per-user tokens rather than one shared package-wide credential.
- Restrict the token to only the required endpoint, Skill identifier, operation, and billing amount.
- Ensure balance-reading authority is excluded unless it is strictly required.
- Add automated secret scanning to source-control and release pipelines.
- Document the external payment service, transmitted fields, destination, and authentication requirements before enabling network access.
