T09 · Insecure Skill Coding Practices
- Location
SKILL.md:131- Finding
API Credentials Exposed Through Standard Output
- Content
View full analysis
/dev/null ``` If the file exists and contains an `api_key`, set it and skip registration: ```bash export UCM_API_KEY=$(cat ~/.config/ucm/credentials.json | grep -o '"api_key":"[^"]*"' | head -1 | sed 's/"api_key":"//;s/"$//') ``` ``` From `scripts/register.sh` when an existing credential is found: ```bash if [ -n "$EXISTING_KEY" ]; then echo "Already registered! Credentials found at $CREDENTIALS_PATH" echo "" echo "API Key: $EXISTING_KEY" echo "" echo "Set it as an environment variable:" echo " export UCM_API_KEY=\"$EXISTING_KEY\"" exit 0 fi ``` From `scripts/register.sh` after registration: ```bash echo "Registration successful!" echo "" echo "API Key: $API_KEY" echo "Credentials saved to: $CREDENTIALS_PATH" echo "" echo "Set it as an environment variable:" echo " export UCM_API_KEY=\"$API_KEY\"" ``` ### Technical Analysis The setup documentation directs the agent or user to print the entire credentials file. The registration script also prints both existing and newly issued API keys to standard output, including a ready-to-copy shell export command. An API key is a bearer credential. Any party that obtains it can authenticate without an additional password or proof of identity. Standard output is not an appropriate secret-delivery channel because it may be captured by: - AI-agent conversation transcripts - CI/CD job logs - Shell session recording - Terminal scrollback - Process wrappers and orchestration systems - Support bundles or diagnostic logs Reading the Skill-specific credentials file is necessary when no environment variable is available. Printing its contents or the extracted key is no ...[truncated 1315 chars]- Remediation
View remediation
