Scanner deep dive
Deploy TruffleHog open source
Maintainer view: on. Activate to switch to the plain view.Every way to run the free trufflehog CLI: on a computer, in Docker, in CI or as a git hook. For TruffleHog Enterprise, see Deploy Enterprise.
Verified against commit 2325546, the same TruffleHog version as the rest of Atlas. Open a tag to see its evidence.
What the tags after each sentence mean
- From source
- Read from TruffleHog's repository at the pinned commit. Shown as a small code icon after the sentence; it opens the exact lines.
- Inferred
- A conclusion the code supports but does not state. The reason and the code it rests on are listed.
- From docs
- TruffleHog Enterprise is not in the open-source code. Quoted from Truffle Security's docs, with the date it was read.
- From the owner
- Stated by the site owner from first-hand knowledge, with the date. Not in public code or docs.
Every way to deploy it
Open source onlyCommands come from the open-source repository's README and PreCommit.md. Enterprise is deployed differently and is not part of this list.
New to Terminal? Words you'll see
To open Terminal on a Mac, press Command and Space, type Terminal and press Return. Paste a command, press Return and wait for it to finish.
- Terminal and shell
- Terminal is the Mac app where you type commands. The shell is the program inside it that runs them; recent Macs use one called zsh.
- Command
- A program you run by typing its name, such as trufflehog or brew.
- PATH
- The list of folders your shell searches when you type a command. If a program isn't in one of them, the shell says it can't find it.
- Package manager
- A tool that downloads programs, puts them where your shell can find them, and updates them. Homebrew is one for Mac and Linux.
- Git hook
- A small script Git runs by itself at a set moment, such as right before each commit.
- CI
- Continuous integration: checks that run on a server, such as GitHub Actions, every time code is pushed.
- Container (Docker)
- A sealed box that runs a program without installing it on your computer.
- Checksum and cosign
- A checksum is a fingerprint of a download. cosign checks the fingerprint was signed by the project, so you know the file wasn't swapped.
Compare them side by side
The Docker commands share one row. Green means it runs or blocks on its own; amber means there's a catch.
1aInstall it on a computer
- No, you run itNo
- Works on
- Mac
- Needs installing
- Yes
- Setup
- One command
- How it updates
- brew upgrade
- No, you run itNo
- Works on
- Linux, Mac, Windows (WSL)
- Needs installing
- Yes
- Setup
- One command
- How it updates
- Run it again, or pin a tag
- No, you run itNo
- Works on
- Linux, Mac, Windows
- Needs installing
- Yes, by hand
- Setup
- A few manual steps
- How it updates
- Download again by hand
- No, you run itNo
- Works on
- Anywhere Go runs
- Needs installing
- Yes, plus Go
- Setup
- Three commands
- How it updates
- Pull and rebuild
- No, your code calls itNo
- Works on
- Go projects
- Needs installing
- Added to your Go code
- Setup
- Your own code
- How it updates
- Update the Go module
1bTry it without installing (Docker)
- No, you run itNo
- Works on
- Unix shells, Windows Command Prompt and PowerShell, Apple-chip Mac
- Needs installing
- No, Docker only
- Setup
- One command
- How it updates
- :latest pulls the newest image
2aCheck every push or pull request (CI/CD)
- Every push or pull requestFails the build
- Works on
- Any CI that runs commands
- Needs installing
- On the runner
- Setup
- One command in your pipeline
- How it updates
- Whatever installs it on the runner
- Every push or pull requestFails the build
- Works on
- GitHub
- Needs installing
- No, runs the Docker image
- Setup
- One workflow file
- How it updates
- Pin one with the version input
- Merge requestsFails the job if pipefail is on
- Works on
- GitLab
- Needs installing
- The job installs it
- Setup
- One job in .gitlab-ci.yml
- How it updates
- The job's install script runs each time
2bStop secrets before they're committed (git hooks)
- Every commitStops the commit
- Works on
- Every repo on one machine
- Needs installing
- Yes, or Docker
- Setup
- Four steps, once per machine
- How it updates
- Follows your installed trufflehog
- Every commit and pushStops the commit or push
- Works on
- One repo
- Needs installing
- Yes, plus the pre-commit tool
- Setup
- A config file and two commands
- How it updates
- Follows your installed trufflehog
- Every commitStops the commit (not the Docker line as written)
- Works on
- One JavaScript repo
- Needs installing
- Yes, or Docker
- Setup
- Two commands and a hook file
- How it updates
- Follows your installed trufflehog
- Every commitNo, reports only
- Works on
- Any hook setup
- Needs installing
- Yes, or Docker
- Setup
- Swap one line in your hook
- How it updates
- Follows your installed trufflehog
- Every push to the serverCan reject the push
- Works on
- A git server you control
- Needs installing
- On the server
- Setup
- Your own script; no ready-made example
- How it updates
- Follows the server's trufflehog
Step 1: Get TruffleHog open source
1aInstall it on a computer
For running scans yourself from a terminal. Each of these puts the trufflehog command on the machine.
- Homebrew
- Macs. The easiest to install and to keep updated, with brew upgrade.
- Install script
- Linux, servers, WSL and CI images, or any machine without Homebrew.
- Release download
- No package manager, or a locked-down machine where you place the program by hand.
- Build from source
- Only to run your own code changes, test something unreleased or contribute. Needs Go installed.
- Go library (developers)
- For developers building TruffleHog into their own Go tools. The README warns the public APIs may change, with no stability guarantee yet.
Commands and details (7)
Homebrew
brew install trufflehogHomebrew, step by step for beginners
In plain words: Homebrew is like an app store you use from Terminal. The README gives this one command for macOS users.
Read first: No brew? Install Homebrew from brew.sh first. When it finishes it prints a few setup lines. Run them too, or brew won't be found.
What each part does
brewHomebrew, the program that does the installing.install trufflehogDownload TruffleHog and put it in Homebrew's folder, which your shell searches once Homebrew is set up.
- What you'll see
- Progress lines while it downloads, then your prompt comes back. The first install can take a minute.
- How it updates
- brew upgrade updates it.
- Can a git hook find it?
- Yes. A hook that looks for the trufflehog command finds it once Homebrew is set up.
- What you're trusting
- Homebrew's package of TruffleHog's release. The easiest of the five to keep updated.
Install script
curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bincurl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -v -b /usr/local/bincurl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin <ReleaseTag like v3.56.0>- -v checks TruffleHog's signed checksum before installing, when you need proof the file is genuine. It needs cosign installed.
- Replace <ReleaseTag like v3.56.0> with a real release tag to pin that version, so every run uses the same one.
Install script, step by step for beginners
In plain words: The README gives a script that downloads and installs TruffleHog. One command fetches the script and runs it straight away.
Read first: This runs code from the internet on your computer. Read the script first, or use the version that checks TruffleHog's signature (Other options to note).
What each part does
curl -sSfL <address>curl downloads the script. s = quiet, S = still show errors, f = stop if the download fails, L = follow redirects.| shThe pipe hands the downloaded script straight to sh, which runs it. This is the moment you trust it.-s --Tells sh to run the script it was handed, and that everything after -- is for the script, not for sh.-b /usr/local/binThe script's own option: the folder to install into.
- What you'll see
- A few download messages, then your prompt comes back. "Permission denied" means that folder needs admin rights; pick a folder you own that's on your PATH instead.
- How it updates
- Run the command again for the newest release, or add a release tag to get a specific one.
- Can a git hook find it?
- Yes, if the folder after -b is on your PATH.
- What you're trusting
- The script and the release it downloads. TruffleHog signs a checksum file you can check.
Release download
cosign verify-blob <path to trufflehog_{version}_checksums.txt> \
--certificate <path to trufflehog_{version}_checksums.txt.pem> \
--signature <path to trufflehog_{version}_checksums.txt.sig> \
--certificate-identity-regexp 'https://github\.com/trufflesecurity/trufflehog/\.github/workflows/.+' \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com"sha256sum --ignore-missing -c trufflehog_{version}_checksums.txt- Download and unpack TruffleHog from its GitHub releases page.
- To check it, also download the release's checksums file and its .pem and .sig files, then run the two commands with {version} replaced by the version you downloaded.
Release download, step by step for beginners
In plain words: You do it by hand: download the program, unpack it, and move it into a folder Terminal searches. No installer.
What each part does
- Open the releases page and pick the newest release.
- Download the file for your computer. darwin means macOS; arm64 is an Apple chip and amd64 an Intel chip.
- Double-click the download to unpack it. Inside is the trufflehog program.
- Move trufflehog into a folder on your PATH, then run the check below.
- What you'll see
- Nothing happens in Terminal until the check. The check tells you whether the move worked.
- How it updates
- Download the newer release by hand.
- Can a git hook find it?
- Yes, after you move it into a folder on your PATH.
- What you're trusting
- The file from TruffleHog's releases page. The README shows how to check its signed checksum with cosign.
Build from source
git clone https://github.com/trufflesecurity/trufflehog.git
cd trufflehog; go installBuild from source, step by step for beginners
In plain words: You download TruffleHog's code and build the program yourself with Go, the language it's written in. Only worth it to change TruffleHog or test something unreleased.
Read first: You need Go installed first. go.mod asks for Go 1.26.
What each part does
git clone <address>Copy TruffleHog's code onto your computer, into a new folder named trufflehog.cd trufflehogMove into that folder.go installBuild the program and put it in Go's bin folder, usually ~/go/bin. That folder must be on your PATH.
- What you'll see
- Very little output while it builds, which can take a few minutes. Your prompt comes back when it's done.
- How it updates
- Pull the newest code and run go install again.
- Can a git hook find it?
- Yes, if Go's bin folder is on your PATH.
- What you're trusting
- TruffleHog's code at whatever version you checked out, built on your machine.
Go library (developers)
- The README gives no setup steps for library use, only the stability warning.
1bTry it without installing (Docker)
For trying it out, or when nothing should be installed on the machine. TruffleHog runs in a container that is deleted when the scan ends.
- Docker
- One command, with a version for each terminal: Mac and Linux, Windows Command Prompt, Windows PowerShell, and Apple-chip Macs.
Commands and details (4)
Docker
Pick your terminal
Unix shells are the terminals on Linux and Mac, such as bash and zsh.
docker run --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keysDocker, step by step for beginners
In plain words: Docker runs programs inside a sealed box called a container. TruffleHog runs in it, scans, and the box is deleted. Nothing is installed on your computer.
Read first: This README command is an example scan of TruffleHog's public test repository. It shows the tool running; it doesn't install anything.
What each part does
docker runStart a container: a sealed box that runs a program.--rmDelete the container when it finishes, so nothing is left behind.-itConnect it to your Terminal so you see the output and can stop it with Control-C.-v "$PWD:/pwd"Share the folder you're in with the container, where it appears as /pwd. This example doesn't use it; you'd need it to scan your own files.trufflesecurity/trufflehog:latestWhich program to run: TruffleHog's official image, newest version.github --repo <address>What TruffleHog should do: scan that public GitHub repository.
- What you'll see
- The first time, Docker downloads the image. Then TruffleHog prints what it finds and the container disappears.
- How it updates
- The :latest tag gets the newest image when one is published.
- Can a git hook find it?
- Not a hook that looks for the trufflehog command on your computer. PreCommit.md also shows a hook written to run this Docker image instead.
- What you're trusting
- Docker's copy of TruffleHog's official image. Docker must already be installed and running.
- All four README commands scan TruffleHog's public test repository as an example. To scan your own files, share the folder with -v and point TruffleHog at the path inside the container.
Check it worked
command -v trufflehog
trufflehog --versionDone when: The first line prints where the program lives. The second prints its version, from the --version flag the CLI defines.
If nothing prints, try these in order
- Close Terminal, open a new window and run the check again. A new window reloads the folders your shell searches.
- If brew itself isn't found, Homebrew's setup step was skipped. Its post-installation steps give the one line to add.
- If you used Docker, nothing printing is expected: it runs in a container, not on your computer.
Step 2: Make it run automatically (optional)
2aCheck every push or pull request (CI/CD)
For catching secrets on every push or pull request, before they are merged.
- Any CI platform
- Any pipeline that can run a command. It scans only the branch's new commits and, with
--fail, exits 183 so the build fails when it prints a result.Scanning a CI server itself (such as Jenkins) is different: it's a source - GitHub Action
- GitHub repositories. TruffleHog's own Action runs its Docker image, so nothing is installed on the runner.
- GitLab CI
- GitLab repositories. A ready-made job that installs TruffleHog with the install script and scans merge requests.
Commands and details (7)
Any CI platform
trufflehog git file://. --since-commit main --branch feature-1 --results=verified,unknown --fail- The README names CircleCI's CIRCLE_BRANCH and Travis CI's TRAVIS_PULL_REQUEST_BRANCH as ways to fill in
--branch. If the branch is already checked out,--branchHEAD is enough. - The runner needs the trufflehog command, for example from the install script or the Docker image.
GitHub Action
Show example (18 lines)
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Secret Scanning
uses: trufflesecurity/trufflehog@main
with:
extra_args: --results=verified,unknownThe README's example adds --results=verified,unknown through extra_args. Without it, the action uses the default, which includes unverified results.
- The README's Action section also notes that TruffleHog detects Canarytokens (canarytokens.org) statically.
--sarifwrites results as SARIF, which GitHub code scanning shows on pull requests. SARIF results are held in memory until the scan ends.
More GitHub Action setups (4)
Show example (19 lines)
...
- shell: bash
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "depth=$(($(jq length <<< '${{ toJson(github.event.commits) }}') + 2))" >> $GITHUB_ENV
echo "branch=${{ github.ref_name }}" >> $GITHUB_ENV
fi
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "depth=$((${{ github.event.pull_request.commits }}+2))" >> $GITHUB_ENV
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v3
with:
ref: ${{env.branch}}
fetch-depth: ${{env.depth}}
- uses: trufflesecurity/trufflehog@main
with:
extra_args: --results=verified,unknown
...Fetches only the pushed or pull request commits plus 2, so a standalone scan workflow checks out less.
Show example (15 lines)
- name: TruffleHog
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
# Extra args to be passed to the trufflehog cli.
extra_args: --log-level=2 --results=verified,unknown
# Scan with a specific TruffleHog version (default: latest).
version:
# Docker image to pull. Override to use a registry mirror (default: ghcr.io/trufflesecurity/trufflehog).
image:base and head map to --since-commit and --branch. version pins a TruffleHog version and image points at a registry mirror.
- name: scan-push
uses: trufflesecurity/trufflehog@main
with:
base: ""
head: ${{ github.ref_name }}
extra_args: --results=verified,unknownAn empty base scans the whole branch instead of only the new commits.
- name: TruffleHog
run: trufflehog filesystem . --sarif --no-verification > results.sarif
- name: Upload SARIF results
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarifThis runs the trufflehog command, not the Action, so the runner needs TruffleHog installed. With --no-verification nothing is checked live.
GitLab CI
Show example (16 lines)
stages:
- security
security-secrets:
stage: security
allow_failure: false
image: alpine:latest
variables:
SCAN_PATH: "." # Set the relative path in the repo to scan
before_script:
- apk add --no-cache git curl jq
- curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin
script:
- trufflehog filesystem "$SCAN_PATH" --results=verified,unknown --fail --json | jq
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'--failmakes TruffleHog exit with code 183 when it prints any result. That means any status that passed--results, not only verified ones. The README says "if valid credentials are found".- The README's CI example scans only the new commits, with
--since-commitand--branch, and uses--results=verified,unknownwith--fail. - The repository ships a GitHub Action. It runs the Docker image as a git scan of the checked-out repository with
--failand GitHub Actions output. It passes no--results, so it uses the default and fails on unverified results too. Extra flags go in its extra_args input. - The README's GitLab CI example runs a filesystem scan with
--results=verified,unknown--failon merge requests. - That example pipes the output into jq. Unless the job's shell has pipefail turned on, the job sees jq's exit code instead of 183 and will not fail when secrets are found, so check your runner's shell settings.
2bStop secrets before they're committed (git hooks)
For stopping a secret before it leaves a developer's laptop. Every hook needs TruffleHog from Step 1, installed on the machine unless the hook runs the Docker image.
- Git hooksPath (every repo on the machine)
- One setup covers every repository on the computer, with nothing to add to each repo.
- pre-commit framework (one repo)
- Teams that already manage hooks with the pre-commit tool. The config lives in the repository, so everyone who installs it gets the same hook.
- Husky (JavaScript projects)
- npm or yarn projects that already manage git hooks with Husky.
- Audit mode (report, don't block)
- To try a hook before enforcing it. It prints what it finds but never stops a commit, because
--failis removed. - Server-side pre-receive hook
- A git server where you can add your own pre-receive hook, to check pushes centrally. The CLI's git
--bareflag is meant for this.
Commands and details (20)
Git hooksPath (every repo on the machine)
mkdir -p ~/.git-hookstouch ~/.git-hooks/pre-commit
chmod +x ~/.git-hooks/pre-commit3. Pick a hook script
#!/bin/sh
export TRUFFLEHOG_PRE_COMMIT=1
trufflehog git file://.git config --global core.hooksPath ~/.git-hooks- Git then uses this folder instead of each repository's own .git/hooks, so hooks a repo already had stop running.
pre-commit framework (one repo)
# Using pip (Python)
pip install pre-commit
# Using Homebrew (macOS)
brew install pre-commit
# Using conda
conda install -c conda-forge pre-commit2. Pick a .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: trufflehog
name: TruffleHog
description: Detect secrets in your data.
entry: bash -c 'trufflehog git file://.'
language: system
stages: ["pre-commit", "pre-push"]pre-commit install- Both configs run on pre-push as well as pre-commit.
Husky (JavaScript projects)
# npm
npm install husky --save-dev
# yarn
yarn add husky --dev# npm
npx husky init3. Pick a hook
echo "trufflehog git file://." > .husky/pre-commitAudit mode (report, don't block)
Pick how you run TruffleHog
trufflehog git file://. --since-commit HEAD --results=verified,unknown 2>/dev/null- It also hides TruffleHog's progress output (2>/dev/null), so only results are printed.
- With the pre-commit framework, add verbose: true during audit mode, or the hook passes silently and you see nothing.
Server-side pre-receive hook
- For server-side pre-receive hooks, git
--barescans a bare repository. Its help text names pre-receive hooks, and the git parser passes GIT_OBJECT_DIRECTORY through when it is set. - Any git server that lets you run your own pre-receive hook can call it this way. Which hosting services allow custom pre-receive hooks is outside this code.
- It switches to hook mode, for the git command only, when PRE_COMMIT, HUSKY or TRUFFLEHOG_PRE_COMMIT is set to 1, or HUSKY_GIT_PARAMS is set to any value.
- In hook mode it sets the commit range to
HEAD..HEAD, which the code says scans only staged changes, turns--failon and trusts the local git config. - It also sets
--results=verified,unknown, but only after the scan engine has already been built from--results. - So that setting has no effect: unverified results still print and still fail the commit, unless you pass
--resultsyourself, as PreCommit.md's example does.
Tips and troubleshooting (from PreCommit.md)
- Run git add and git commit as separate steps, so TruffleHog sees everything you're committing.
- Avoid git commit -am, which can skip the hook for changes you haven't staged.
- Anyone can skip the hook with
--no-verify, so a hook alone doesn't enforce anything. Pair it with a CI check if you need enforcement. - Too many false positives? Show only verified results with
--results=verified, or add atrufflehog:ignorecomment to lines you've accepted.
git commit --no-verify -m "Your commit message"chmod +x .git/hooks/pre-commitgit config --get core.hooksPathReference
Every scan command
The CLI has 18 scan commands, plus analyze. multi-scan reads several sources from a config file.
Flags you'll see in these commands (19)
Help text is copied from TruffleHog’s code. For what verified, unverified and unknown mean, see How verification works.
| Flag | Help text | In the code |
|---|---|---|
| --results | Specifies which type(s) of results to output: verified (confirmed valid by API), unknown (verification failed due to error), unverified (detected but not verified), filtered_unverified (unverified but would have been filtered out). Defaults to verified,unverified,unknown. | main.go line 62 (opens TruffleHog source on GitHub) |
| --fail | Exit with code 183 if results are found. | main.go line 82 (opens TruffleHog source on GitHub) |
| --since-commit | Commit to start scan from. | main.go line 110 (opens TruffleHog source on GitHub) |
| --branch | Branch to scan. | main.go line 111 (opens TruffleHog source on GitHub) |
| --only-verified | Only output verified results.(hidden from --help) | main.go line 61 (opens TruffleHog source on GitHub) |
| --no-verification | Don't verify the results. | main.go line 60 (opens TruffleHog source on GitHub) |
| --json | Output in JSON format. | main.go line 55 (opens TruffleHog source on GitHub) |
| --sarif | Output in SARIF format for upload to GitHub code scanning (e.g. via github/codeql-action/upload-sarif). | main.go line 58 (opens TruffleHog source on GitHub) |
| --github-actions | Output in GitHub Actions format. | main.go line 57 (opens TruffleHog source on GitHub) |
| --trust-local-git-config | Trust local git config. | main.go line 116 (opens TruffleHog source on GitHub) |
| --bare | Scan bare repository (e.g. useful while using in pre-receive hooks) | main.go line 113 (opens TruffleHog source on GitHub) |
| --no-update | Don't check for updates. | main.go line 81 (opens TruffleHog source on GitHub) |
| --config | Path to configuration file. | main.go line 78 (opens TruffleHog source on GitHub) |
| --concurrency | Number of concurrent workers. | main.go line 59 (opens TruffleHog source on GitHub) |
| --log-level | Logging verbosity on a scale of 0 (info) to 5 (trace). Can be disabled with "-1". | main.go line 50 (opens TruffleHog source on GitHub) |
| --include-detectors | Comma separated list of detector types to include. Protobuf name or IDs may be used, as well as ranges. | main.go line 90 (opens TruffleHog source on GitHub) |
| --exclude-detectors | Comma separated list of detector types to exclude. Protobuf name or IDs may be used, as well as ranges. IDs defined here take precedence over the include list. | main.go line 91 (opens TruffleHog source on GitHub) |
| --include-paths | Path to file with newline separated regexes for files to include in scan. | main.go line 107 (opens TruffleHog source on GitHub) |
| --exclude-paths | Path to file with newline separated regexes for files to exclude in scan. | main.go line 108 (opens TruffleHog source on GitHub) |
Worked examples from the README (22)
The README’s Quick Start, as written. Placeholders in angle brackets are yours to fill in. Each example links to the source it scans.
trufflehog git https://github.com/trufflesecurity/test_keys --results=verifiedtrufflehog github --org=trufflesecurity --results=verifiedtrufflehog github --org=trufflesecurity --exclude-archivedtrufflehog git https://github.com/trufflesecurity/test_keys --results=verified --jsontrufflehog github --repo=https://github.com/trufflesecurity/test_keys --issue-comments --pr-commentstrufflehog s3 --bucket=<bucket name> --results=verified,unknowntrufflehog s3 --role-arn=<iam role arn>docker run --rm -v "$HOME/.ssh:/root/.ssh:ro" trufflesecurity/trufflehog:latest git ssh://github.com/trufflesecurity/test_keystrufflehog filesystem path/to/file1.txt path/to/file2.txt path/to/dirgit clone git@github.com:trufflesecurity/test_keys.gittrufflehog gcs --project-id=<project-ID> --cloud-environment --results=verified# to scan from a remote registry
trufflehog docker --image trufflesecurity/secrets --results=verified
# to scan from the local docker daemon
trufflehog docker --image docker://new_image:tag --results=verified
# to scan from an image saved as a tarball
trufflehog docker --image file://path_to_image.tar --results=verifiedtrufflehog postman --token=<postman api token> --workspace-id=<workspace id>trufflehog jenkins --url https://jenkins.example.com --username admin --password admintrufflehog elasticsearch --nodes 192.168.14.3 192.168.14.4 --username truffle --password hogtrufflehog elasticsearch --nodes 192.168.14.3 192.168.14.4 --service-token ‘AAEWVaWM...Rva2VuaSDZ’trufflehog elasticsearch \
--cloud-id 'search-prod:dXMtY2Vx...YjM1ODNlOWFiZGRlNjI0NA==' \
--api-key 'MlVtVjBZ...ZSYlduYnF1djh3NG5FQQ=='trufflehog github-experimental --repo https://github.com/<USER>/<REPO>.git --object-discoverytrufflehog huggingface \
--model <model_id> \
--dataset <dataset_id> \
--space <space_id> \
--bucket <bucket_id>trufflehog huggingface --org <orgname> --user <username>trufflehog huggingface --model <model_id> --include-discussions --include-prsaws s3 cp s3://example/gzipped/data.gz - | gunzip -c | trufflehog stdinConfig files and custom detectors
- A config file, passed with
--config, can hold custom regex detectors and sources. Regex detectors work with any scan command; sources are only read by multi-scan. - Custom regex detectors need at least one regular expression and one keyword. To verify matches, TruffleHog posts them to a webhook you run; a 200 OK means verified.
- The verify section is optional. Without it, matches are reported as unverified, which suits flagging generic passwords in config files.
- Custom regex detectors are marked alpha and may change.
sources:
- connection:
'@type': type.googleapis.com/sources.GitHub
repositories:
- https://github.com/trufflesecurity/test_keys.git
unauthenticated: {}
name: example config scan
type: SOURCE_TYPE_GITHUB
verify: trueFurther reading
- Since v3.0, TruffleHog is released under the AGPL-3.0 license.