ghtier
← Secret scanning
Secret scanningOpen source

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
Last push
28 Oct 2026
OpenSSF Scorecard
Not in the weekly scan
ghtier ratingRated 5 of 5, Top pick5/5 · Top pick

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.

Related tools

Related incidents

GitHub stats as of 30 Oct 2026. How ratings work.