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.

ClaudeHermes AgentCodexCursorMIT (modify, redistribute and use commercially)Python

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:line with a masked value (e.g. ghp_******45 (len 40)); full secret values are never printed
  • Flags .env files tracked by git and a .gitignore that does not cover .env
  • --history also scans added lines in git log -p --all to find secrets and .env files that were ever committed
  • Compares .env.example with env vars read in code (process.env, import.meta.env, os.environ, os.getenv, os.Getenv and 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

  1. Unzip the downloaded file (it contains a env-secret-leak-check/ folder with SKILL.md).
  2. 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
  3. Restart the agent and check that the skill appears in its skill list.

Step-by-step install for Windows / Mac and each agent

Seller

AI Skill Market (official)

44 published skills

Seller profile and all skills