Overview
TruffleHog searches code and supported data sources for credentials and other secrets, with verification capabilities for supported detectors. Treat results as sensitive, restrict access to reports and rotate any confirmed credential promptly.
Key features
Secret discovery; supported source integrations; credential verification for supported detectors; CI use.
Install & first run
# Homebrew (Linux and macOS)
brew install trufflesecurity/trufflehog/trufflehog
# Docker
docker run --rm -it trufflesecurity/trufflehog:latest github --repo https://github.com/org/repo
# Scan a repository's full history and keep only live, verified secrets
trufflehog git https://github.com/org/repo --only-verified
# Scan a directory, or a container image
trufflehog filesystem ./path
trufflehog docker --image myapp:latest
--only-verified is the difference between a usable report and a wall of false positives - it calls the provider to test each key. Docs: https://github.com/trufflesecurity/trufflehog
Real-world example
Scan your own repositories and development history, verify findings safely, then revoke exposed credentials and prevent recurrence.
Common questions
Should scan results be published in tickets or public logs?
No. They can contain live credentials; redact them and restrict access.
What does verification mean?
It calls the provider with the discovered key. A live key is a real incident; an unverified string is a lead you still have to check.
Will it scan my whole organisation?
Per repository or per path. For org-wide coverage, run it in CI on every push and add the GitHub app or scheduled scans.
Does it handle non-git sources?
Yes: S3, GCS, Docker images, filesystem paths, Elasticsearch and more. Each has its own subcommand.
Related tools
Gitleaks
Scan git history or a plain directory for committed API keys, tokens and passwords, then block new ones before the commit. Free, open source.
Semgrep
Static analysis that understands code structure, so it catches tainted input and risky patterns without a build step. Free, open source.
Related reading: TruffleHog vs Gitleaks: Secret Scanning Compared
Keep exploring: browse every assessment phase in the Pentest Hub.
Authorized testing only — only ever test systems you own or have explicit written permission to assess.
