T09 · Insecure Skill Coding Practices
- Location
SKILL.md:796- Finding
Insecure API Key Storage Guidance
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 796–799
Vulnerability Type: Insecure plaintext credential storage guidance
Risk Level: MediumVulnerable Code Snippet:
markdown ### API Key 配置 - 本地存储功能无需额外API Key - 并行调度与成本追踪使用Agent平台内置LLM - 所有API Key通过环境变量配置,禁止硬编码 - 建议将API Key存储在`~/.swarm/credentials/`目录(已gitignore)Technical Analysis
The Skill recommends storing API keys in the predictable
~/.swarm/credentials/directory without requiring restrictive file permissions, encryption, an operating-system keychain, or an Agent-platform secret manager. It also states that the directory is protected by Git ignore rules, but the audited project contains no.gitignorefile or setup command that creates and verifies such protection.The guidance is internally ambiguous because it first requires environment-variable configuration and then recommends filesystem storage. Environment variables may be populated from a credential file, but the Skill does not define a secure loading mechanism or safeguards for that file. Git ignore rules would only reduce accidental repository commits; they would not prevent access by other local users, compromised processes, backup software, indexing services, or tools with home-directory read access.
Attack Path
- A user follows the Skill's recommendation and writes an API key under
~/.swarm/credentials/. - The credential directory or file is created with default permissions that permit access beyond the owning user, or it is collected by backup or indexing software.
- A malicious local user, compromised process, or Agent tool with home-directory access searches the documented, predictable path.
- The attacker reads and extracts the plaintext API key.
- The attacker reuses the key against the associated service until the credential is revoked or expires.
Impact Assessment
Successful exploitation can disclose API credentials and grant the ...[truncated 462 chars]
- A user follows the Skill's recommendation and writes an API key under
- Remediation
View remediation
Remediation Suggestions
- Prefer the Agent platform's managed secret store, an operating-system keychain, or a dedicated secret-management service.
- Remove the unsupported claim that the directory is already protected by Git ignore rules.
- If file-based storage is unavoidable:
- Create the credential directory with mode
0700. - Create each credential file with mode
0600. - Verify ownership and permissions before reading a key.
- Store one clearly identified secret per file and never print its value.
- Prevent credentials from appearing in logs, reports, prompts, command history, or generated artifacts.
- Create the credential directory with mode
- Add and verify explicit ignore rules for credential files where repository-local configuration is supported. Clarify that Git ignore rules do not provide confidentiality.
- Document credential rotation, revocation, expiration, and least-scope requirements.
- Make the configuration guidance unambiguous by specifying how a managed secret or protected file is securely loaded into the required environment variable.
