T09 · Insecure Skill Coding Practices
- Location
references/apikey-fetch.md:47- Finding
API Key Exposure Through Plaintext Storage and Unsafe Verification Guidance
- Content
View full analysis
Vulnerability Details
File Location:
references/apikey-fetch.md:47-76
Vulnerability Type: Plaintext credential handling and secret disclosure
Risk Level: MediumVulnerable Code Snippet:
markdown **Option A — shell environment** Export the API key before running the skill: ```bash export SKYWORK_API_KEY="your_actual_skywork_api_key_here"To persist it across sessions, add the same line to
~/.zshrcor~/.bashrc, then reload the shell.Option B — Claude Code settings
Add the variable to
~/.claude/settings.json:json { "env": { "SKYWORK_API_KEY": "your_actual_skywork_api_key_here" } }Use the method that best matches how you run Claude Code.
4. Verify Configuration
bash # Check that the environment variable is available echo "$SKYWORK_API_KEY"text ### Technical Analysis The setup guide recommends storing the Skywork API key in plaintext shell initialization files or a user configuration file without providing file-permission hardening guidance. It then instructs the user to print the complete credential with `echo "$SKYWORK_API_KEY"`. Printing the secret is unnecessary for determining whether the variable is configured and violates least-disclosure principles. The complete key may be captured by terminal transcripts, shell-session recording, CI/CD logs, agent execution logs, screen sharing, screenshots, or copied diagnostic output. Plaintext persistence also makes the key accessible to any process or user able to read the relevant configuration file. This finding is limited to insecure credential-handling documentation. The application code itself sends the key only as an HTTPS bearer token to the fixed Skywork API endpoint, which is necessary for the declared image-generation functionality. ### Attack Path 1. A user follows the documented setup procedure and places a valid API key in a shell startup file or `~/.claude/ ...[truncated 1140 chars]- Remediation
View remediation
Remediation Suggestions
-
Remove the command that displays the full credential. Verify only whether the variable exists:
bash if test -n "${SKYWORK_API_KEY:-}"; then echo "SKYWORK_API_KEY is configured" else echo "SKYWORK_API_KEY is not configured" fi -
If partial identification is operationally necessary, display only a short masked suffix and never log the complete value.
-
Prefer runtime secret injection through the platform's credential store or a dedicated operating-system secret manager instead of persistent plaintext storage.
-
If file-based storage is unavoidable, document restrictive permissions:
bash chmod 600 ~/.claude/settings.json chmod 600 ~/.openclaw/openclaw.json -
Warn users not to commit credential-bearing files, paste them into support requests, expose them in screenshots, or run secret-display commands in recorded or shared terminals.
-
Recommend immediate key revocation and rotation whenever accidental disclosure is suspected.
-
