r/coolgithubprojects • • 42m ago

I built leakcheck: a zero-dependency Python tool that blocks commits containing API keys, tokens and passwords

What My Project Does

leakcheck scans a folder or git repo for secrets that shouldn't be there: AWS keys, GitHub tokens, Discord bot tokens, Slack, Stripe, OpenAI and Anthropic keys, private keys, JWTs, passwords in URLs, and password = "..." assignments. It has 19 rules, plus a high-entropy check for random-looking strings that no rule recognises.

  • leakcheck . prints the file, line and severity of each finding. The secret itself is always masked.
  • leakcheck --install-hook adds a git pre-commit hook that scans exactly what you staged and blocks the commit if it finds a secret.
  • It respects .gitignore, but still scans files that are already tracked.
  • Text or JSON output, and exit code 1 on findings, so it can fail a CI job.
  • Standard library only, Python 3.9+, tested on Linux, macOS and Windows.

Target Audience

Anyone who has pushed a .env file or a hardcoded token by accident, especially hobby and small-team projects. Discord bot developers in particular: Discord tokens are decoded and the bot ID inside is checked, which cuts down false alarms. It's v0.1.0, usable today but young.

Comparison

  • gitleaks and trufflehog are more mature, have bigger rule sets and scan your whole git history. trufflehog can even check whether a key still works. leakcheck does not scan history.
  • detect-secrets is also Python, but it's built around a baseline file and has dependencies.
  • leakcheck's angle: zero dependencies, one install, one command, a hook that only checks your staged lines, and output that never shows the full secret.

Install: pip install git+https://github.com/obloat/leakcheck

Repo, with a demo GIF: https://github.com/obloat/leakcheck

Built with help from Claude. Feedback, false positives and missing token types are very welcome.

2 Upvotes

0 comments sorted by