T09 · Insecure Skill Coding Practices
Error
- Location
- .env:1
- Finding
- Hard-Coded AtlasCloud API Credential<![CDATA[ ## Vulnerability Details **File Location**: `.env:1` **Vulnerability Type**: Hard-coded secret **Risk Level**: High ### Vulnerable Code ```dotenv ATLASCLOUD_API_KEY=apikey-8e638200e8554e6691207441b78bcd79 ``` ### Technical Analysis The project contains a plaintext AtlasCloud API key in its distributed `.env` file. A credential committed or packaged with source code must be considered compromised because every person, process, archive, build system, or repository mirror with access to the project can retrieve it. The key appears to use the same bearer-token authentication mechanism expected by `generate.js`. If it remains active, an unauthorized party can submit requests to the AtlasCloud API under the associated account. ### Attack Path 1. An attacker obtains a copy of the project directory, source archive, repository, build artifact, or backup. 2. The attacker opens `.env` and extracts the AtlasCloud API key. 3. The attacker supplies the key as a bearer token in requests to the AtlasCloud API. 4. Requests execute under the privileges, quota, and billing scope assigned to the exposed key. No local privilege escalation is required; read access to the project is sufficient. ### Impact Assessment An attacker may obtain the API privileges granted to the exposed AtlasCloud key. The likely scope includes unauthorized image-generation jobs, quota consumption, service abuse, and potential billing impact. The key does not, based on the reviewed evidence, directly grant operating-system privileges. Because the credential has already been exposed in plaintext, merely deleting it from the current file is insufficient; historical copies may continue to contain it. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke the exposed key immediately and issue a replacement. 2. Remove `.env` from the distributed package and all version-control history where feasible. 3. Add `.env` and other secret-bearing files to `.gitignore` and package exclusion rules. 4. Distribute an `.env.example` containing only a placeholder such as: ```dotenv ATLASCLOUD_API_KEY=replace_with_your_key ``` 5. Inject the key at runtime through a protected environment variable, secret manager, or standard input. 6. Restrict the replacement key to the minimum API permissions and quota required. 7. Enable provider-side usage monitoring, spending limits, expiration, and rotation. 8. Review AtlasCloud usage records for unauthorized activity associated with the exposed key. ]]>
