Gitleaks
Finds secrets in git history, files or stdin with regex, keyword and entropy rules.
github.com/gitleaks/gitleaks ↗- Stars
- ★ 30,523
- License
- MIT
- Language
- Go
- Latest release
- v8.30.1 · 21 Mar 2026
- Last push
- 28 Oct 2026
- OpenSSF Scorecard
- Not in the weekly scan
The default open-source secret scanner: one binary, no network, easy rules and baselines.
Note: this page is AI generated. Read the tool's own repository and documentation, linked at the bottom, before you rely on it.
How it works
Gitleaks is a Go binary. For a repository it runs git log -p and scans each patch, so it sees secrets that were added and later deleted. It can also scan a plain directory or stdin.
Rules live in a TOML config: each has a regex, optional keywords that must appear first (a cheap pre-filter), an entropy threshold and allowlists. The default config covers a few hundred token formats. Known findings can be ignored with a baseline report, a .gitleaksignore file of fingerprints, or a gitleaks:allow comment.
Output is JSON, CSV, JUnit, SARIF or a custom template, with --redact to keep matches out of logs. The exit code is non-zero when anything is found.
What it catches
- Cloud keys, GitHub tokens, Slack and Stripe tokens and other known formats
- Private keys and generic high-entropy secrets
- Secrets removed from HEAD but still in history
- New secrets in a PR's commit range
Run it
brew install gitleaks
gitleaks detect --source . --redact
# only the commits in a PR:
gitleaks detect --source . --redact --log-opts="origin/main..HEAD"What leaves your machine
Nothing. Scanning is local.
Limits
- It does not check whether a secret is live; TruffleHog's verification does.
- Custom token formats need your own rules.
- The official gitleaks-action needs a free license key for organization accounts, which is why many workflows install the binary instead.
Links
Related tools
Related incidents
GitHub stats as of 30 Oct 2026. How ratings work.