T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:31
- Finding
- API Key Persisted in a Plaintext Skill-Local File## Vulnerability Details **File Location**: `SKILL.md`, lines 31-37 **Vulnerability Type**: Plaintext sensitive credential storage **Risk Level**: Medium ### Vulnerable Code ```markdown 6. Resolve credentials only from `api_key` in the directory containing this `SKILL.md`. Read its first non-empty line. Do not inspect environment variables or any other local path. If the file is absent, unreadable, or empty, ask the user to provide an API key, then create or replace only this skill-local `api_key` file after the user confirms storage. Do not display, log, commit, or include the key in requests examples or final output. 7. Before uploading a document to ComPDF, identify the affected files and destination, and obtain confirmation unless the user has explicitly authorized that upload. Also obtain confirmation before operations that overwrite, delete, decrypt, or apply permanent protection. 8. Return the endpoint, method, content type, complete request fields, expected task/result fields, and the next polling or download step. Preserve original files unless replacement is explicitly requested. ## Credentials Store only the current skill's API key in the sibling `api_key` file. This file is private runtime state and must be excluded from version control and skill publishing. ``` ### Technical Analysis The Skill explicitly instructs the agent to save the ComPDF API key in a plaintext file named `api_key` alongside `SKILL.md`. Although it states that the file must not be logged, committed, or published, it does not require restrictive filesystem permissions, ownership validation, encryption, atomic creation, or use of a protected credential manager. A file created under the process's default `umask` may be readable by other local users or processes. It may also be collected by backup software, copied during packaging, or accidentally published because the project does not contain an actual ignore rule demonstrating that the file is ex ...[truncated 1377 chars]
- Remediation
- ## Remediation Suggestions 1. Prefer an operating-system credential manager, agent secret store, or managed secrets service instead of a plaintext project file. 2. If file-based storage is unavoidable, create the file atomically with owner-only permissions such as `0600`. 3. Validate the file's owner, type, and permissions before reading it; reject symbolic links and files accessible by group or other users. 4. Keep runtime secrets outside the publishable project directory. 5. Add an explicit version-control ignore rule for `api_key` and configure packaging tools to exclude it. 6. Avoid exposing the key in command-line arguments, logs, examples, exception messages, or generated reports. 7. Document API-key revocation and rotation procedures and recommend immediate rotation after suspected disclosure. 8. Use a narrowly scoped key where ComPDF supports permission or quota restrictions.
