The best free, open-source secret scanner depends on where you need to look and how you want to handle findings. Gitleaks focuses on Git and files, TruffleHog scans a wider range of sources and can check whether some supported credentials are live, Yelp’s detect-secrets is built around reviewing existing findings and catching new ones, and Trivy adds secret detection to a broader security scanner. None is established as universally fastest or most accurate; test your candidates against representative repositories and workflows.
Compare the four tools at a glance
| Tool | Best fit | Distinctive workflow | License and maintenance |
|---|---|---|---|
| Gitleaks | Git repositories, files, and local commit checks | Command-line scans, documented pre-commit hook, and GitHub Action | MIT. The project says it is feature complete and future releases will be security patches only. |
| TruffleHog | Auditing secrets across varied source types | Broad source coverage; attempts provider login checks for supported credential types | AGPL-3.0 for v3; review implications for your deployment and redistribution. |
| Yelp detect-secrets | Introducing checks to an established repository | Review and label a baseline, then use a hook to detect newly introduced findings | Apache-2.0. |
| Trivy | Teams that want secrets checked alongside other security risks | Scans secrets as part of a tool that also covers vulnerabilities, dependencies, infrastructure misconfigurations, and licenses | Apache-2.0. |
These are different operating models, not a quality ranking. The project materials do not establish comparable independent results for current versions, so treat coverage, false-positive rates, and runtime as questions to measure in your own environment.
As an Amazon Associate I earn from qualifying purchases.
Which scanner fits your workflow?
Gitleaks: Git-oriented checks, with a maintenance caveat
Gitleaks detects passwords, API keys, and tokens in Git repositories, files, and standard input. Its repository documents installation options including Homebrew, Docker, Go, and platform binaries, as well as pre-commit and GitHub Action workflows. That makes it a practical fit for a local check before a commit or a repository-focused scan. However, the current project README says, “Gitleaks is feature complete. I’m not merging new features into Gitleaks. Future releases will be security patches only.” Teams adopting it should weigh that maintenance direction alongside its workflow fit.
Recommended Free Tools
TruffleHog: wider source coverage and selective live checks
TruffleHog documents scanning Git, collaboration and wiki platforms, logs, API testing platforms, object stores, filesystems, Docker images, and other sources. It classifies detected credential types and can attempt to log in to a provider to determine whether a supported credential is live. This is a useful way to prioritize some findings, but a pattern match alone does not establish that a credential works, and not every arbitrary string can be validated. Use provider checks only with appropriate authorization. TruffleHog documents JSON and SARIF output and GitHub Actions pathways; its v3 project license is AGPL-3.0, so assess the license against your deployment and redistribution plans.
#1 Best Overall
Yelp detect-secrets: baseline first, incremental checks after
For a repository that already contains potential secrets, detect-secrets offers a baseline workflow: scan the current repository, review and label existing findings, then use its hook to flag newly introduced secrets in staged or tracked files. This helps separate pre-existing issues from new ones without repeatedly rescanning the entire repository for every incremental check. It is not a substitute for a full-history audit. The project also documents configurable plugins, including provider-specific and entropy-based detectors, plus Python integration.
Trivy: secrets within a broader security scan
Trivy includes sensitive-information and secret scanning alongside checks for vulnerabilities, software dependencies, infrastructure misconfigurations, and licenses. Its documented targets include filesystems, remote Git repositories, container images, virtual machine images, and Kubernetes. Choose it when consolidating these checks in one scanner is valuable or your team already uses Trivy. The project materials support breadth as its differentiator; they do not establish that its secret detection outperforms dedicated tools.
Choose based on where and when you scan
Match scan scope to likely exposure
A local file scan, a Git repository scan, a scan of complete history, and a scan across hosted organizations or cloud storage are not interchangeable. List the places credentials could appear in your environment, then confirm that a candidate documents support for those sources. TruffleHog documents the broadest range among these four; Gitleaks centers on Git and files, while Trivy documents filesystem, remote Git, image, VM image, and Kubernetes targets.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Decide when checks should run
- Before a commit: Gitleaks documents a pre-commit hook; detect-secrets documents a hook for staged or tracked files.
- In CI: Gitleaks documents a GitHub Action, and TruffleHog documents GitHub Actions and SARIF output pathways.
- For periodic or wider audits: select targets that cover your repositories and other relevant stores, rather than assuming a commit hook sees every exposure.
Plan for existing findings and noise
detect-secrets makes review of a baseline an explicit part of adoption. Gitleaks documents baselines and ignore configuration. In either case, evaluate findings against real repositories: the available project descriptions do not establish a universal false-positive rate. Decide who reviews findings, how legitimate exceptions are recorded, and how exposed credentials are handled.
Check license and maintenance fit
Gitleaks is MIT licensed, with the feature-complete and security-patch-only notice described above. detect-secrets and Trivy are Apache-2.0; TruffleHog v3 is AGPL-3.0. Confirm current project terms and assess how they apply to your use before adopting or redistributing a tool.
How to keep API keys out of Git
- Put credentials outside tracked source files. Use your organization’s approved secret store or environment-specific configuration, and ensure local secret files are excluded from version control.
- Add a commit-time check. Configure a documented Gitleaks or detect-secrets hook so developers can catch likely leaks before committing. A hook reduces risk but does not replace scans in CI or repository audits.
- Scan existing code and history as appropriate. Choose a scanner and target that match the exposure you need to assess; a staged-file check does not inspect every remote store or historical commit.
- Review findings and prevent recurrence. Establish who triages alerts and how exceptions are documented. If a real credential is exposed, treat it as compromised and follow the issuing provider’s revocation and replacement process.
Where GitHub’s built-in secret scanning fits
GitHub documents automatic secret scanning at no charge for public repositories. For organization-owned private and internal repositories, the feature requires GitHub Secret Protection on eligible GitHub Team or Enterprise Cloud plans. It can complement or serve as a platform-specific alternative to cross-platform tools, but availability depends on repository ownership and plan eligibility. See GitHub’s instructions for enabling secret scanning.
Quick Recap
Best Value
How to evaluate candidates in your environment
- Run each candidate against representative repositories and source types.
- Compare whether it finds the credential formats and locations relevant to your organization.
- Measure false positives and runtime under your own conditions rather than relying on unsupported rankings.
- Check that output and integrations fit your review process, such as local hooks, CI, JSON, or SARIF where documented.
- Confirm license terms, maintenance direction, and the team’s capacity to operate the scanner.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




