T09 · Insecure Skill Coding Practices
- Location
scripts/check-secrets.sh:45- Finding
Secret Scanner Prints Detected Credentials in Plaintext
- Content
View full analysis
/dev/null || true) if [ -n "$MATCH" ]; then echo " 🚨 POSSIBLE SECRET in $file:" echo "$MATCH" | head -3 | sed 's/^/ /' ERRORS=$((ERRORS + 1)) fi done <<< "$FILES" done ``` ### Technical Analysis The scanner stores the complete matching source lines in `MATCH` and prints up to three of them without redaction. The configured patterns match API tokens, passwords, bearer tokens, AWS access-key identifiers, GitHub tokens, Slack tokens, and JWT-like values. Consequently, the scanner can reproduce the actual credential in its output. Security scanners should report the affected file, line number, and secret type while suppressing or masking the sensitive value. Printing the complete line can move a secret from a relatively restricted source file into less protected locations such as CI logs, terminal recordings, agent transcripts, build artifacts, or centralized logging systems. This behavior does not require command injection or control of the scanner itself. It is triggered by the presence of a credential matching one of the scanner's regular expressions. ### Attack Path 1. A secret is accidentally committed, generated, or otherwise placed in a scannable project file. 2. A developer, AI agent, pre-commit hook, or CI job executes `check-secrets.sh`. 3. `grep -Pn` returns the complete matching line, including the secret. 4. The script prints that line to standard output. 5. CI logging, terminal recording, or an agent execution environment retains the output. 6. A user with access to those logs can recover and use the expose ...[truncated 781 chars]- Remediation
View remediation
