T09 · Insecure Skill Coding Practices
- Location
config.env:1- Finding
Plaintext API Credential Stored in the Project
- Content
View full analysis
Vulnerability Details
File Location:
config.env:1
Vulnerability Type: Hardcoded secret / plaintext API credential
Risk Level: HighVulnerable Code
env DEEPSEEK_API_KEY=sk-058c451313aa4510a8a42818da613fe9Technical Analysis
The project contains a DeepSeek API key in plaintext. The application reads the key from the
DEEPSEEK_API_KEYenvironment variable inscripts/chat.js:3-4and places it in the HTTPAuthorizationheader atscripts/chat.js:27-28:javascript const API_KEY = process.env.DEEPSEEK_API_KEY; const API_URL = 'https://api.deepseek.com';javascript headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', 'Content-Length': data.length }Although transmitting the credential to the documented DeepSeek HTTPS endpoint is required for the advertised functionality, distributing the credential in
config.envexposes it to anyone who can access the project package, repository, backups, build artifacts, or shared filesystem. Environment-variable usage does not protect a secret when its value is committed alongside the source code.Attack Path
- An attacker obtains a copy of the project or access to its source repository, package, backup, or build artifact.
- The attacker opens
config.envand extracts the plaintext DeepSeek API key. - The attacker uses the key as a Bearer token in requests to the DeepSeek API.
- Requests execute under the credential owner's API account until the key is revoked, expires, or is otherwise restricted.
Impact Assessment
An attacker may consume the account's API quota, incur financial charges, exhaust usage limits, and make API requests attributable to the credential owner. The precise scope is limited to the permissions and account resources granted to this key; the reviewed files do not establish broader host or system privileges.
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke the exposed credential and generate a replacement. Treat the current key as compromised even if unauthorized use has not yet been observed.
- Review provider-side usage and billing logs for suspicious requests made with the exposed key.
- Remove
config.envfrom distributed packages, repository history, release artifacts, caches, and backups where feasible. - Add
config.envand equivalent local secret files to.gitignoreand packaging exclusion rules. - Supply the replacement key only at runtime through a secret manager, protected deployment configuration, or environment variable that is not committed to source control.
- Provide a safe template such as
config.env.examplecontaining only a placeholder:
env DEEPSEEK_API_KEY=replace-with-your-own-key- Apply provider-supported restrictions such as spending limits, scoped permissions, expiration, and key rotation.
- Add automated secret scanning to pre-commit hooks and CI pipelines to prevent future credential commits.
