T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/register.sh:18
- Finding
- API Bearer Credential Exposed Through Terminal Output and Plaintext Storage Guidance## Vulnerability Details **File Location**: `scripts/register.sh:18-40`; `SKILL.md:26-35` **Vulnerability Type**: Plaintext sensitive-data exposure **Risk Level**: Medium ### Vulnerable Code `scripts/register.sh:18-40`: ```bash API_KEY=$(echo "$RESPONSE" | jq -r '.agent.api_key') AGENT_ID=$(echo "$RESPONSE" | jq -r '.agent.id') PLOT_X=$(echo "$RESPONSE" | jq -r '.agent.plot.x') PLOT_Y=$(echo "$RESPONSE" | jq -r '.agent.plot.y') DISTRICT=$(echo "$RESPONSE" | jq -r '.agent.plot.district') echo "" echo "✅ Registration successful!" echo "" echo "Agent ID: $AGENT_ID" echo "API Key: $API_KEY" echo "Plot: $DISTRICT ($PLOT_X, $PLOT_Y)" echo "Starting Coins: 100" echo "" echo "Save this to your TOOLS.md:" echo "" echo "## ClawVille" echo "- API Key: $API_KEY" echo "- Agent ID: $AGENT_ID" echo "- Plot: $DISTRICT ($PLOT_X, $PLOT_Y)" echo "" echo "Set environment variable:" echo "export CLAWVILLE_API_KEY=$API_KEY" ``` `SKILL.md:26-35`: ```markdown Save the `api_key` from the response — you'll need it for all API calls. ### 2. Store Your Credentials Add to your TOOLS.md or a secure config: ``` ## ClawVille - API Key: cv_sk_xxxxx - Agent ID: youragent_xxxxx - Plot: District (x, y) ``` ``` ### Technical Analysis The registration script extracts a bearer API key from the remote response and prints the complete credential multiple times to standard output. It also directs users to save the key in `TOOLS.md`, while the skill documentation independently recommends the same plaintext storage option. Bearer credentials grant access based on possession. Printing the complete key can expose it through terminal scrollback, agent conversation transcripts, command-execution logs, CI logs, monitoring systems, screen recordings, or support bundles. Saving it in a documentation file creates additional exposure through source-control commits, backups, workspace indexing, file synchronization, a ...[truncated 1631 chars]
- Remediation
- ## Remediation Suggestions 1. Do not print the complete API key. Display only a redacted identifier, such as the first and last four characters. 2. Remove all guidance recommending storage in `TOOLS.md` or other documentation files. 3. Store the credential directly in an approved operating-system keychain, secrets manager, or dedicated configuration file with permissions restricted to the owning user. 4. If file-based storage is unavoidable, create the file with a restrictive `umask`, enforce mode `0600`, and keep it outside the project repository. 5. Add relevant secret files to `.gitignore`, while making clear that ignore rules are not a substitute for secure storage. 6. Avoid printing a ready-to-copy shell command containing the secret, because shell history and transcripts may retain it. 7. Document credential rotation and revocation procedures, and rotate any keys previously stored or logged using the affected workflow. 8. Consider accepting the key through a protected environment-injection mechanism without echoing it back to the user.
