T09 · Insecure Skill Coding Practices
- Location
SKILL.md:31- Finding
Plaintext API Key Stored at a Predictable Local Path
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 31-39
Vulnerability Type: Plaintext credential storage
Risk Level: MediumVulnerable 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. ## 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. To obtain an API key, register or sign in at [ComPDF Portal](https://www.compdf.com/compdf-portal/signin?utm_source=clawhub&utm_medium=referral&utm_campaign=compdf_skills_repo_en&ref_platform_id=clawhub_compdfkit_skills_en). On first use, provide the key when requested and confirm storing it in the skill-local `api_key` file; later requests reuse that stored key.Technical Analysis
The Skill directs the agent to persist the ComPDF API key as plaintext in a predictable file named
api_keybesideSKILL.md. Although it identifies the file as private runtime state and prohibits logging or committing the key, it does not require owner-only file permissions, atomic creation, permission verification, encryption at rest, or use of a protected credential store.A process or local user able to read the Skill directory could retrieve the credential directly. The predictable location also increases the chance that backup, synchronization, packaging, or publication processes will collect it. The instruction to exclude the file from version control is procedural and is not backed by an enforced ignore rule in the audited project.
...[truncated 1058 chars]
- Remediation
View remediation
Remediation Suggestions
- Prefer an operating-system credential store, managed secret service, or platform-provided secret interface instead of a plaintext file.
- If file storage is unavoidable, create the file atomically with owner-only permissions, such as mode
0600, and reject files owned by another user or accessible by a group or other users. - Avoid following symbolic links when creating or replacing the credential file, and verify that the resolved path remains inside the Skill directory.
- Add and distribute an enforced ignore rule for
api_key, while also excluding it from packaging, backup, synchronization, and publication workflows. - Never include the key in command-line arguments, logs, examples, generated reports, or exception messages.
- Provide key revocation and rotation guidance, and rotate the credential immediately if the file may have been exposed.
- Request explicit user consent before persistence and provide an option to use the key only for the current operation without storing it.
