Scan files for leaked secrets (cloud, GitHub, Slack, Stripe, Google, AI keys, private keys, high-entropy assignments) with output that never prints the secret. Use when the user asks to check staged files or a repo for secrets before committing.
95%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Medium
Suggest reviewing before use
Detects ten kinds of secrets in text files and reports where they are without ever printing the full
value (at most four leading characters plus ****). Python 3.10+, nothing to install or compile, no network.
It scans the files you give it. It does not read git history and cannot validate whether a match is a live credential.
Choose the files. For staged changes, list them yourself and pass them as arguments:
git diff --cached --name-only --diff-filter=ACM
python3 scripts/scan_secrets.py path/one.py path/two.envRead each line path:line:column: rule-id: redacted. Open the file at that position and decide if it is a real secret.
If it is real: remove it from the code and load it at run time from the user's secret store; treat the value as exposed and tell the user to rotate it (anything that reached a shared remote or log is compromised).
If it is a placeholder or test value, either change it so it no longer looks like a credential, or add the
marker secrets-precommit:allow in a comment on the same line, or list the path or value pattern in the config allowlist.
Re-run the same command until it exits 0.
Never copy a secret into your reply, a commit message or a report; quote the rule id, file and line only.
| Code | Meaning |
|---|---|
| 0 | Nothing found |
| 1 | At least one potential secret |
| 2 | Usage, configuration or read error (and nothing found) |
python3 scripts/scan_secrets.py [--config FILE] [--format text|json] [--no-defaults] [--verbose] FILE...--config FILE: team rules and allowlists in JSON (see references/config.md).--format json: findings as a JSON array with ruleId, path, line, column, redacted.--no-defaults: only the team rules from the config.--verbose: list skipped files (binary, over 1 MiB, symlink, directory, allowlisted) on stderr.aws-access-key-id, github-token, github-fine-grained-pat, slack-token, stripe-live-key,
google-api-key, anthropic-api-key, openai-api-key, private-key-block, generic-assignment.
Patterns and entropy threshold: references/rules.md. Running it automatically on each commit with the
user's own hook: references/hook.md.
Secrets in history, encoded (base64, hex) or split across lines are not found; a match can be a false positive; anyone who can edit the allowlist or add the allow marker can suppress findings.
repository in the plugin manifest, or publish from a GitHub Action to verify it.