Open-source project
trufflesecurity/trufflehog avatar
trufflesecurity/trufflehog

TruffleHog: A Secrets Scanner That Verifies What It Finds

TruffleHog scans repositories, filesystems, and cloud services for exposed credentials, then checks whether the secrets still work.

27,908 stars2,578 forksGoAGPL-3.0

At a glance

What is it?
TruffleHog scans Git repos, filesystems, and cloud services for exposed credentials, then logs in to confirm which ones still work. This review covers its detection pipeline, setup options, and the trade-offs of its AGPL-3.0 license.
Who is it for?
Adopt TruffleHog if you need to scan Git history, orgs, or cloud services for credentials and want verification that a found secret is actually live. Skip it if you require a permissive license for embedding in proprietary tools, since AGPL-3.0 imposes copyleft obligations.
Can I use it commercially?
Yes, with strict conditions. AGPL-3.0 is a network copyleft licence: if people use a modified version over a network, for example as a hosted service, you must offer them its source code under the same licence.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What TruffleHog Actually Does Differently

Most secret scanners stop at pattern matching. They flag strings that look like API keys and leave you to guess which ones matter. TruffleHog adds a validation step: for each classified secret, it attempts to log in to the corresponding service to confirm the credential is live. The README frames this as Discovery, Classification, Validation, and Analysis. That distinction matters. A leaked key that has been revoked is noise. A live key is an incident. TruffleHog's core value is separating those two cases. It also performs deeper analysis for about 20 common credential types, sending multiple requests to learn who created the secret, what resources it can access, and what permissions it holds. The project is written in Go and distributed as a single binary, which keeps deployment simple.

How the Detection Pipeline Works

The pipeline starts with a source. The README shows sources like git repositories, filesystems, and cloud services. For each source, TruffleHog extracts candidate strings, then classifies them against a detector library that covers over 800 secret types. Each detector maps a string to a specific identity, such as an AWS key or a Stripe token. After classification, the validation phase sends a live request to the service's API to check if the credential still authenticates. The analysis phase goes further for the most common types, querying metadata about the secret's owner and permissions. The output includes the detector type, the raw result, line number, commit hash, file name, and timestamp. This structure means you get not just a hit, but a context-rich report that tells you exactly where the leak lives in history.

Running TruffleHog: Commands and Setup

Installation has several paths. On macOS, `brew install trufflehog` works. Docker is documented for Unix, Windows Command Prompt, PowerShell, and Apple Silicon with a platform flag. There is also an install script: `curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin`. For a quick start, the README shows `trufflehog git https://github.com/trufflesecurity/test_keys --results=verified`, which scans a repo and only prints verified secrets. For a GitHub org, use `trufflehog github --org=trufflesecurity --results=verified`. To skip archived repos, add `--exclude-archived`. JSON output is available, though the exact flag is truncated in the README. The CLI also supports scanning filesystems and cloud services, but the README does not show those commands, so you will need `trufflehog --help` to discover them.

Verification and Supply Chain Security

The project takes artifact integrity seriously. Every release includes a checksums file, a PEM certificate, and a signature. Verification uses cosign, a Sigstore tool. The README gives a concrete command sequence: download the three files, run `cosign verify-blob` with the certificate and signature, then run `sha256sum --ignore-missing -c trufflehog_{version}_checksums.txt`. The installation script also supports a `-v` flag to perform signature verification, provided cosign is installed. This is a meaningful step for a tool that handles credentials. You are trusting it with sensitive data, so knowing the binary you run is the one the maintainers built reduces supply chain risk. The certificate identity regexp pins the signature to the GitHub Actions workflow, which is a solid practice.

Limitations and Failure Modes

TruffleHog's validation step is a double-edged sword. To confirm a secret is live, it sends real authentication requests to third-party services. That means the scanner generates network traffic and could trigger rate limits or alerts on the target services. In a high-volume scan, this could be noisy or slow. The README does not mention any dry-run mode or rate limiting configuration, so you must be prepared for that behavior. Another limitation: validation only covers the secret types that have detectors. The README claims classification for over 800 types, but not all may have live validation. The analysis phase is limited to about 20 types. For anything outside those, you get classification but not the deep metadata. Finally, the tool is designed for scanning, not continuous monitoring. The README points to a separate enterprise product for ongoing monitoring of Git, Jira, Slack, and Confluence. If you need that, the open source version alone will not cover it.

Licensing and Maintenance Cost

TruffleHog is licensed under AGPL-3.0. That is a strong copyleft license. If you embed or modify the code and distribute it over a network, you must offer the source to users. For internal security tooling, this is often fine. For a commercial product that integrates secret scanning into a SaaS offering, it can be a problem. The README does not discuss dual licensing, but the enterprise product page suggests the company monetizes separately. The repository is active, with releases like v3.97.1 in August 2026, so maintenance appears ongoing. The cost of keeping up is real: new detector types and source integrations arrive frequently, and you will want to update to catch new secret formats. The install script supports pinning a version, so you can control upgrades.

Alternatives and How They Differ

A common alternative is gitleaks, which also scans Git repositories for secrets. The key difference is that gitleaks focuses on detection using regex and entropy, but it does not validate whether a secret is live. You get a list of potential leaks, but you must manually test each one. TruffleHog's validation step is the differentiator. Another alternative is using GitHub's built-in secret scanning, which runs on GitHub-hosted repos and integrates with push events. That approach is limited to GitHub and does not cover filesystems or other cloud providers. TruffleHog is source-agnostic and runs locally, so you can scan a repo before it ever reaches GitHub. The trade-off is that TruffleHog requires you to run it, while GitHub's scanning is automatic. Choose based on whether you need verification (TruffleHog) or breadth of source coverage with automatic operation (GitHub native).

Who Should Adopt TruffleHog

TruffleHog fits teams that have a concrete need to audit existing repositories or cloud storage for leaked credentials and want to prioritize remediation by live status. Security engineers who can run a CLI and parse JSON output will find it straightforward. It also suits incident response, where you need to know if a leaked key is still active. Teams that require a permissive license for redistribution should look elsewhere. The AGPL constraint is not trivial. Before adopting, verify the exact sources you need: the README documents GitHub orgs and repos clearly, but filesystem and cloud scanning commands are not shown, so check the CLI help. Also, ensure your environment allows outbound network calls for validation. If you cannot tolerate live login attempts, you can use the `--results=verified` flag only after scanning, but the validation step is inherent to the tool's design.

Editorial conclusion

Adopt TruffleHog if you need to scan Git history, orgs, or cloud services for credentials and want verification that a found secret is actually live. Skip it if you require a permissive license for embedding in proprietary tools, since AGPL-3.0 imposes copyleft obligations. Before rolling out, verify your exact scan targets: the README shows clear commands for GitHub orgs and repos, but you must check the CLI help for filesystem or cloud provider flags, as those are not documented in the provided material. Also confirm that your outbound network allows requests to credential providers, because validation sends live login attempts.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Community notes

Community notes