Secrets Scan

sonnet session

Quick reference

FieldValue
Command/brewtools:secrets-scan
Arguments[--fix] — no args = scan only, --fix = interactive remediation
Modelsonnet
Contextsession
ToolsRead, Task, Write, Bash, AskUserQuestion

Security audit for leaked credentials in git-tracked files. Spawns 10 parallel agents to scan the entire repository, classifies findings by severity, and generates a detailed report.

Modes

ModeHow to triggerWhat it does
Scan only/brewtools:secrets-scanScans all git-tracked files, generates severity-ranked report
Scan + fix/brewtools:secrets-scan --fixScans, then walks through each CRITICAL/HIGH finding interactively
Auto-fix promptNo flag neededIf CRITICAL or HIGH findings exist, prompts whether to remediate

Usage examples

# Pre-commit security check on the full repo
/brewtools:secrets-scan

# Scan and fix all findings interactively
/brewtools:secrets-scan --fix

# Run before open-sourcing a private repo
/brewtools:secrets-scan --fix

What it detects

CategoryExamples
Passwordspassword=, passwd:, secret=, pwd= followed by a value
API Keysapi_key, access_key, apikey, api_secret
Tokenstoken, bearer, auth_token, access_token
AWS CredentialsAKIA[0-9A-Z]{16}, aws_secret, aws_access_key
Database URLsJDBC, MongoDB, MySQL, PostgreSQL connection strings with embedded credentials
Private Keys-----BEGIN ... PRIVATE KEY-----, client_secret, encryption_key

Skipped automatically: environment variable references (process.env.*, ${VAR}, os.getenv()), common placeholders (changeme, YOUR_KEY, xxx, dummy), documentation comments, binary files.

Severity levels

LevelCriteria
CRITICALReal credentials, private keys, database connection strings with passwords
HIGHReal API keys or tokens, AWS credentials
MEDIUMSuspicious hardcoded values that may be secrets
LOWPlaceholder values like changeme, YOUR_KEY, xxx, dummy

Fix mode options

OptionAction
FixDelete or replace the secret inline
Move to env varExtract value into environment variable reference
Add to .gitignoreAppend the file path to .gitignore
Mark false positiveAcknowledge and skip
SkipLeave as-is, move to next finding

Output

Report location: .claude/reports/{TIMESTAMP}_secrets-scan/report.md

SectionContent
SummaryFile counts, severity breakdown (CRITICAL / HIGH / MEDIUM / LOW)
FindingsPer-severity tables with file path, line number, matched content, description
Agent StatsPer-agent breakdown of assigned, scanned, and finding counts
File InventoryComplete list of scanned and skipped files with reasons

Tips

Run early, run often — catch leaked secrets before they reach a remote branch. Expect false positives from test fixtures and example configs; use —fix to mark them. Combine with .gitignore rules and pre-commit hooks for defense in depth.