T09 · Insecure Skill Coding Practices
- Location
SKILL.md:273- Finding
Inadequately Protected Persistent Token Storage
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 273-277
Vulnerability Type: Plaintext or insufficiently protected credential storage
Risk Level: MediumRelevant snippet translated into English:
markdown ### API Key Configuration - The team collaboration workspace requires a team token: `api-doc collab login` - Code scanning is performed locally and does not upload source code - All tokens are configured through environment variables; hardcoding is prohibited - It is recommended to store tokens in the `~/.api-doc/credentials/` directory (gitignored)Technical Analysis
The Skill recommends persistently storing authentication tokens under
~/.api-doc/credentials/, but it does not define filesystem permissions, encryption, ownership validation, atomic file creation, log-redaction requirements, token expiration, or secure deletion.The claim that the directory is gitignored does not protect its contents from other local users, compromised processes, backup software, archive operations, or accidental disclosure outside Git. The guidance is also internally ambiguous because it requires environment-variable configuration while separately recommending filesystem persistence.
This storage behavior is not necessary for the core API-document generation and source-scanning functions. If collaboration authentication requires persistence, an operating-system credential manager or another protected secret store should be used.
Attack Path
- A user runs
api-doc collab loginand supplies a valid team token. - The Agent or CLI follows the documented recommendation and persists the token under
~/.api-doc/credentials/. - The credential file is created with default or otherwise permissive access because the Skill defines no restrictive permissions.
- Another local user, compromised process, backup reader, or archive recipient obtains the stored token.
- The attacker uses the token to i ...[truncated 644 chars]
- A user runs
- Remediation
View remediation
Remediation Suggestions
- Replace filesystem token persistence with the operating system's credential manager, such as Keychain, Credential Manager, or Secret Service.
- If file storage is unavoidable:
- Create the credential directory with mode
0700. - Create credential files with mode
0600. - Validate that the directory and files are owned by the current user.
- Reject symbolic links and unsafe pre-existing files.
- Use atomic file creation to reduce race-condition risks.
- Encrypt credentials at rest using a key not stored beside the token.
- Create the credential directory with mode
- Ensure authentication tokens never appear in generated documentation, command output, error messages, telemetry, or logs.
- Implement token expiration, rotation, revocation, and secure deletion during logout.
- Clarify whether environment variables or protected persistent storage is the authoritative authentication mechanism.
- Remove the suggestion that being gitignored constitutes adequate credential protection.
