TruffleHog v3 is a complete rewrite in Go with many new powerful features.
For every potential credential that is detected, we’ve painstakingly implemented programatic verification against the API that we think it belongs to. Verification eliminates false positives. For example, the AWS credential detector performs a GetCallerIdentity API call against the AWS API to verify if an AWS credential is active.
Several options:
git clone https://github.com/trufflesecurity/trufflehog.git
cd trufflehog; go install
Note: Apple M1 hardware users should run with docker run --platform linux/arm64 for better performance.
docker run -it -v “$PWD:/pwd” trufflesecurity/trufflehog:latest github –repo https://github.com/trufflesecurity/test_keys
The linux/arm64 image is better to run on the M1 than the amd64 image. Even better is running the native darwin binary avilable, but there is not container image for that.
docker run –platform linux/arm64 -it -v “$PWD:/pwd” trufflesecurity/trufflehog:latest github –repo https://github.com/trufflesecurity/test_keys
It’s possible to distribute binaries in pip wheels.
Here is an example of a project that does it.
Help with setting up this packaging would be appreciated!
brew tap trufflesecurity/trufflehog
brew install trufflehog
TruffleHog has a sub-command for each source of data that you may want to scan:
Each subcommand can have options that you can see with the -h flag provided to the sub command:
$ trufflehog git –help
usage: TruffleHog git []
Find credentials in git repositories.
Flags:
–help Show context-sensitive help (also try –help-long and –help-man).
–debug Run in debug mode
–version Prints trufflehog version.
-j, –json Output in JSON format.
–json-legacy Use the pre-v3.0 JSON format. Only works with git, gitlab, and github sources.
–concurrency=1 Number of concurrent workers.
–no-verification Don’t verify the results.
–only-verified Only output verified results.
–print-avg-detector-time Print the average time spent on each detector.
–no-update Don’t check for updates.
-i, –include-paths=INCLUDE-PATHS
Path to file with newline separated regexes for files to include in scan.
-x, –exclude-paths=EXCLUDE-PATHS
Path to file with newline separated regexes for files to exclude in scan.
–since-commit=SINCE-COMMIT
Commit to start scan from.
–branch=BRANCH Branch to scan.
–max-depth=MAX-DEPTH Maximum depth of commits to scan.
–allow No-op flag for backwards compat.
–entropy No-op flag for backwards compat.
–regex No-op flag for backwards compat.
Args:
Git repository URL. https:// or file:// schema expected.
For example, to scan a git repository, start with
$ trufflehog git https://github.com/trufflesecurity/trufflehog.git
Exit Codes:
--fail flag is used.Try scanning an entire GitHub organization with the following
docker run -it -v “$PWD:/pwd” trufflesecurity/trufflehog:latest github –org=trufflesecurity
name: TruffleHog OSS
uses: trufflesecurity/trufflehog@main
with:
# Repository path
path:
# Start scanning from here (usually main branch).
base:
# Scan commits until here (usually dev branch).
head: # optional
The TruffleHog OSS Github Action can be used to scan a range of commits for leaked credentials. The action will fail if any results are found.
For example, to scan the contents of pull requests you could use the following workflow:
name: Leaked Secrets Scan
on: [pull_request]
jobs:
TruffleHog:
runs-on: ubuntu-latest
steps:
– name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
– name: TruffleHog OSS
uses: trufflesecurity/trufflehog@v3.4.3
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
General Working of a Web Application Firewall (WAF) A Web Application Firewall (WAF) acts as…
How to Send POST Requests Using curl in Linux If you work with APIs, servers,…
If you are a Linux user, you have probably seen commands like chmod 777 while…
Vim and Vi are among the most powerful text editors in the Linux world. They…
Working with compressed files is a common task for any Linux user. Whether you are…
In the digital era, an email address can reveal much more than just a contact…