Repo secret leak and .env drift check
Find API keys, tokens, private keys and committed .env files in the working tree and git history, reported as file:line with masked values, plus .env.example drift.
What it does
Checks a repository for leaked credentials before you publish it or hand it over.
- Scans the working tree (tracked files plus untracked files that are not ignored) for AWS, GitHub, GitLab, Slack, Stripe, OpenAI, Anthropic, Google, SendGrid, npm, PyPI and Hugging Face key formats, private key blocks, JWTs, passwords embedded in connection strings, and high-entropy values in assignments like
password = "..." - Reports
file:linewith a masked value (e.g.ghp_******45 (len 40)); full secret values are never printed - Flags
.envfiles tracked by git and a.gitignorethat does not cover.env --historyalso scans added lines ingit log -p --allto find secrets and.envfiles that were ever committed- Compares
.env.examplewith env vars read in code (process.env,import.meta.env,os.environ,os.getenv,os.Getenvand more): used but undocumented, documented but not found in code - Placeholder-looking values and values under test or fixture folders are shown at lower severity
How to use
python scripts/secret_scan.py . --json secret-report.json
python scripts/secret_scan.py . --history --max-commits 500
The agent verifies each hit (real secret, test value or false positive) and reports remediation with revoking and rotating the key first. Exit code is 1 when a HIGH finding exists, so it also works in CI.
Requirements
- Python 3 (standard library only)
- git for the history scan
Caveats
- Read-only: no edits, deletions or history rewrites (rewrites are only suggested).
- Pattern matching has false positives and false negatives. No findings means no known pattern matched.
- A secret that was ever pushed must be treated as leaked and rotated, even after removal.
How to install
- Unzip the downloaded file (it contains a
env-secret-leak-check/folder withSKILL.md). - Copy the whole folder into your agent's skills folder.
- Claude:
~/.claude/skills/(per project:.claude/skills/) - Hermes Agent:
~/.hermes/skills/ - Codex:
~/.agents/skills// Cursor:~/.cursor/skills/ - Claude app (claude.ai): upload the ZIP in Customize → Skills
- Claude:
- Restart the agent and check that the skill appears in its skill list.
Seller
AI Skill Market (official)
44 published skills