By viderstar
Stop an agent from committing secrets, and clean up the ones already committed.
npx claudepluginhub viderstar/secrets-guardDeterministic secret protection for coding agents: a hook that denies a commit or push whose diff contains a credential, and a scanner plus skill for the secrets already in the repository, with a masked report and a rotation checklist.
Stop a coding agent from committing secrets — and clean up the ones that are already in.
A Claude Code plugin. The pieces are dependency-free Python scripts, so they work outside Claude Code too.
"Never commit secrets" in CLAUDE.md is advice, and advice gets skipped: the model is
mid-task, the diff is large, the line looks like configuration. This reads the diff that is
actually about to be committed or pushed and denies on a match. It is not persuasion, it is
a gate.
-----BEGIN ... PRIVATE KEY-----)user:password inside a URL — the classic pip-index and database-DSN leakos.getenv("DB_PASSWORD", "...") — the pattern that
keeps a rotated credential silently alivePlaceholders (<your token>, ${VAR}, changeme), comparisons and reads from the
environment are not flagged.
| Piece | When it runs |
|---|---|
hooks/secrets-guard.py | PreToolUse on Bash. On git commit it reads the staged diff, on git push everything not yet upstream. A match is denied with the offending lines masked. |
scripts/secrets_scan.py | On demand. Scans tracked files and, with --history, added lines in past commits. Prints a masked Markdown table and a rotation checklist. Exits 1 on findings, so it gates CI. |
secrets-cleanup skill | Teaches the agent the workflow: scan, never echo values, rotate at the service, replace with a no-default env read, file the ticket, re-scan. |
claude plugin marketplace add ViderStar/secrets-guard
claude plugin install secrets-guard@secrets-guard
The hook needs no configuration. The scanner:
python3 scripts/secrets_scan.py ~/code/my-repo
python3 scripts/secrets_scan.py ~/code/my-repo --history --commits 300 --out findings.md
In CI:
- run: python3 scripts/secrets_scan.py . || exit 1
~/.config/secrets-guard/patterns.json:
{
"placeholders": ["acme-demo-key"],
"ignore_regexes": ["EXAMPLE_[A-Z]+", "tests/fixtures/"]
}
Two shapes are skipped on purpose, because they are where false positives come from:
a key: value whose value contains whitespace (English prose about the word "secret" —
"a webhook URL is itself a secret: whoever knows it can post"), and a value that is a
function call or attribute lookup (client_secret = vault.get("app")). A real secret in
YAML or JSON never contains a space, and a literal is not a call.
Bypass at commit time, when you are sure it is a false positive:
SECRETS_GUARD_ALLOW=1 git commit -m "add the sample config"
Every bypass — and every case where the hook could not determine the diff and let the
command through — is appended to ~/.config/secrets-guard/secrets-guard.log. Failing open
is deliberate: a guard that wedges someone's work gets uninstalled.
Deleting the line does not protect anything. The value is in the history of everyone who
cloned the repository, and git log -p is one command. A committed secret has to be
rotated at the service that issued it. The scanner's checklist says this every time
because it is the step that gets skipped.
MIT.
7-day visitors to each marketplace page
Anthropic's Claude Code plugins, installed from the claude-plugins-official repository
RuFlo Marketplace: Claude Code native agents, swarms, workers, and MCP tools for continuous software engineering
Keygraph's Shannon autonomous AI pentester, packaged as a plugin for Claude Code.