T09 · Insecure Skill Coding Practices
- Location
scripts/feishu.py:136- Finding
Hard-Coded SkillPay API Credential in Distributed Source Code
- Content
View full analysis
Vulnerability Details
File Location:
scripts/feishu.py, lines 136–139
Vulnerability Type: Hard-coded service credential
Risk Level: HighVulnerable Code
python def _skillpay_headers(): api_key = "sk_e8d7b86db13746fdbdd3a02d34f118a276d32629b3ef8bc55838d68f560e2c1b" if not api_key: return {"X-API-Key": api_key}Technical Analysis
A SkillPay API key is embedded directly in the distributed Python source. Anyone able to download, inspect, or otherwise access the Skill package can recover this credential without executing the code.
The exact privileges assigned to the key cannot be determined from the repository. However, the code uses it as an
X-API-Keywhen calling SkillPay billing and payment-link endpoints. An attacker could therefore attempt to invoke any SkillPay API operation authorized for that key.The snippet also contains an indentation error because the
returnstatement is not indented beneath theifstatement. As shipped, this causes a parse-timeIndentationErrorand prevents the script from executing. This availability defect does not protect the exposed credential because it remains readable in plaintext.Attack Path
- An attacker obtains the publicly distributed or locally installed Skill package.
- The attacker opens
scripts/feishu.pyand extracts the plaintext API key. - The attacker sends requests to SkillPay with the recovered value in the
X-API-Keyheader. - If the key remains active, the attacker can exercise whatever billing or account privileges SkillPay assigned to it.
- The resulting activity may be attributed to the legitimate Skill publisher.
Impact Assessment
Potential impact includes unauthorized SkillPay API access, fraudulent or manipulated billing activity, service abuse, quota consumption, and reputational or financial harm to the credential owner. The maximum scope is limited to the permissions assigned to the ex ...[truncated 163 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the exposed SkillPay API key.
- Remove the credential from the source code and repository history.
- Load the replacement credential from a protected secret manager or, at minimum, a dedicated environment variable.
- Configure the key with the least possible privileges and restrict it by endpoint, tenant, origin, or network location where supported.
- Add secret scanning to pre-commit hooks and CI pipelines.
- Correct the indentation and add a syntax-compilation test such as
python3 -m py_compile scripts/feishu.py. - Do not publish the replacement credential in examples, documentation, logs, or generated packages.
