T09 · Insecure Skill Coding Practices
- Location
submit.sh:41- Finding
Incomplete Sanitization Can Disclose Sensitive Workspace Data
- Content
View full analysis
Vulnerability Details
File Location:
submit.sh:41-49andsubmit.sh:83-85
Vulnerability Type: Insufficient sensitive-data redaction before external transmission
Risk Level: HighVulnerable Code
bash CONTENT=$(cat "$WORKSPACE/$file" | \ sed -E 's/[a-zA-Z0-9_-]*[Kk][Ee][Yy][a-zA-Z0-9_-]*[=:][[:space:]]*[^[:space:]\n]+/[REDACTED]/g' | \ sed -E 's/sk-[a-zA-Z0-9]+/[API_KEY_REDACTED]/g' | \ sed -E 's/xoxb-[a-zA-Z0-9-]+/[TOKEN_REDACTED]/g' | \ sed -E 's/ghp_[a-zA-Z0-9]+/[TOKEN_REDACTED]/g' | \ sed -E 's/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/[EMAIL_REDACTED]/g' | \ sed -E 's/\+?[0-9]{1,3}[-.\s]?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}/[PHONE_REDACTED]/g' | \ sed -E 's/([0-9]{1,3}\.){3}[0-9]{1,3}/[IP_REDACTED]/g' | \ python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))")bash RESPONSE=$(curl -s -X POST "$WEBHOOK_URL" \ -H "Content-Type: application/json" \ -d "$PAYLOAD")Technical Analysis
The script sends the contents of eight potentially sensitive workspace files to an external service after applying only a small collection of regular-expression substitutions. The filters recognize a limited set of token prefixes and simplistic patterns for contact information, IP addresses, and names containing
key.This block does not reliably detect or remove numerous common secret formats, including:
- PEM-encoded private keys and other multiline credentials
- JSON Web Tokens
- Generic bearer or authorization tokens
- Password assignments that do not contain the word
key - Database connection strings containing credentials
- Cloud-provider credentials that do not match the listed prefixes
- Session cookies and arbitrary application tokens
- Environment-variable values generally
- Credentials embedded in URLs
The implementation therefore does not provide the comprehensive sanitization claimed in `SKILL ...[truncated 1560 chars]
- Remediation
View remediation
Remediation Suggestions
- Prefer an allowlist-based submission format that extracts only architecture information required for the audit instead of transmitting complete files.
- Integrate a mature secret-scanning library or tool that supports private keys, JWTs, cloud credentials, bearer tokens, connection strings, passwords, cookies, and multiline values.
- Scan both before and after redaction. Abort submission when a possible secret remains and require the user to review it manually.
- Add automated tests containing representative credential formats and verify that none appear in the final serialized payload.
- Exclude highly sensitive files by default and require explicit, per-file opt-in.
- Provide a local copy of the exact final payload for inspection before transmission.
- Document that automated redaction is best-effort rather than guaranteeing removal of all credentials or PII.
