T09 · Insecure Skill Coding Practices
- Location
scripts/agent.py:56- Finding
Hardcoded API Authentication Token in Source Code
- Content
View full analysis
Vulnerability Details
File Location:
scripts/agent.py, line 56
Vulnerability Type: Hardcoded secret
Risk Level: HighVulnerable Code
python env["ANTHROPIC_AUTH_TOKEN"] = "sk-sp-5cec1d99ac9f4848b2dc625406bea113"Technical Analysis
The source code contains a live-looking API bearer token. Because the token is distributed with the project, anyone who can read the source code can extract and attempt to use it.
The implementation also contradicts the environment-based configuration documented in
SKILL.md. Instead of relying on an externally supplied secret, it unconditionally replacesANTHROPIC_AUTH_TOKENin the copied process environment. Secret rotation and deployment-specific configuration are therefore bypassed.Attack Path
- An attacker obtains a copy of the project source, package, repository history, artifact, or backup.
- The attacker extracts the token from line 56.
- The attacker submits requests to the configured Anthropic-compatible Alibaba Cloud API using the exposed token.
- Requests are attributed to the account associated with the token until it is revoked, expires, or is otherwise restricted.
Impact Assessment
If the token remains valid, an attacker may consume the associated API quota, incur financial charges, exhaust rate limits, access resources available to the credential, or cause abuse-related account suspension. The exact scope depends on the server-side permissions assigned to the token.
The secret must be treated as compromised because it has already been embedded in distributable source code.
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed token immediately.
- Remove the credential from the current source and repository history.
- Obtain the token from a secret manager or deployment environment:
python token = os.environ.get("ANTHROPIC_AUTH_TOKEN") if not token: raise RuntimeError("ANTHROPIC_AUTH_TOKEN is required") env["ANTHROPIC_AUTH_TOKEN"] = token - Use a dedicated, minimally privileged credential with spending limits, rate limits, and endpoint restrictions.
- Add automated secret scanning to version-control and CI workflows.
- Review provider logs for unauthorized use of the exposed credential.
