TruffleHog Executor¶
Category: Source Code Analysis
Script: trufflehog.py
Integration: CLI
Faraday Plugin: Raw JSON
Website: trufflesecurity/trufflehog
Description¶
Runs a TruffleHog secrets scan and imports each detected secret into Faraday as a vulnerability. Secrets that TruffleHog verifies against the provider are marked as verified and get a higher severity.
Prerequisites¶
trufflehog(v3) installed and available in the agent'sPATH(checked withtrufflehog --version)git, if you scan a repository by URL- Read access to the target, either as a local path or a Git repository
- Internet access from the agent, if you want TruffleHog to verify the secrets it finds
Configuration¶
Environment Variables (Setup)¶
| Variable | Required | Description |
|---|---|---|
GIT_USERNAME |
No | Username for cloning private repositories over HTTPS (default: oauth2) |
GIT_TOKEN |
No | Access token for cloning private repositories over HTTPS |
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
TRUFFLEHOG_TARGET |
string | No* | What to scan, as expected by the selected mode (e.g., a directory for filesystem). When TRUFFLEHOG_GIT_URL is set, it is a subpath inside the cloned repository. |
TRUFFLEHOG_MODE |
string | No | TruffleHog subcommand to run, such as filesystem or git (default: filesystem) |
TRUFFLEHOG_ONLY_VERIFIED |
boolean | No | Set to true to report only verified secrets |
TRUFFLEHOG_NO_UPDATE |
boolean | No | Skip TruffleHog's self-update check (default: true) |
TRUFFLEHOG_GIT_URL |
url | No* | Git repository to clone and scan |
TRUFFLEHOG_GIT_REF |
string | No | Branch or tag to clone (default: the repository's default branch) |
* You must set TRUFFLEHOG_TARGET, TRUFFLEHOG_GIT_URL, or both.
YAML Configuration Example¶
executors:
trufflehog:
repo_executor: trufflehog.py
max_size: 65536
varenvs:
GIT_USERNAME: "<git_username>"
GIT_TOKEN: "<git_token>"
params:
TRUFFLEHOG_TARGET:
mandatory: false
type: string
base: string
TRUFFLEHOG_MODE:
mandatory: false
type: string
base: string
TRUFFLEHOG_ONLY_VERIFIED:
mandatory: false
type: boolean
base: boolean
TRUFFLEHOG_NO_UPDATE:
mandatory: false
type: boolean
base: boolean
TRUFFLEHOG_GIT_URL:
mandatory: false
type: url
base: string
TRUFFLEHOG_GIT_REF:
mandatory: false
type: string
base: string
How It Works¶
- If
TRUFFLEHOG_GIT_URLis set, makes a shallow clone of the repository (atTRUFFLEHOG_GIT_REF, if given) into a temporary directory. For HTTPS URLs it authenticates withGIT_USERNAME/GIT_TOKEN. - Runs
trufflehog <mode> <target> --json, adding--no-updateand--only-verifiedwhen enabled - Groups the findings by the file (or repository) where each secret was found
- Creates one vulnerability per finding:
- Name: the detector name plus
secret, with(verified)for verified secrets - Severity:
highfor verified secrets,mediumotherwise - Description: the detector, the verification result, the first 6 characters of the secret and its location
- Name: the detector name plus
- Deletes the temporary clone when the run ends
Notes¶
- Each file with findings becomes a host whose name is the file path (or the repository, or the target when TruffleHog gives no location).
- Only the first 6 characters of each secret are stored in Faraday.
- With a Git URL, TruffleHog scans the cloned working tree. Use the default
filesystemmode in that case. - The shared agent parameters (
AGENT_CONFIG_*tags and severity filters) are not applied by this executor. UseTRUFFLEHOG_ONLY_VERIFIEDto reduce noise.