Scanner deep dive
Verification
Workflow stage 3 · Validate: establish validity where safe, authorized and supported; preserve uncertainty. This page covers how TruffleHog does that. For the vendor-neutral guidance, see the response workflow in Foundations.
Verification statuses
Finding a string that looks like a key is not enough. TruffleHog can ask the provider whether the key works, and reports one of three statuses.
The README calls verification critical "to know if there’s an active present danger or not".
Verified
The provider confirmed the secret works.
Unknown
Verification was attempted or skipped and recorded an error, so the answer is not known.
Unverified
Found, but not confirmed and with no verification error.
The notifier decides the status from two fields on each result: if Verified is set, it is verified. Otherwise, a verification error makes it unknown, and no error makes it unverified.
Decision rules
When a match is checked, what happens when detectors overlap, and how results are cached.
Will this match be verified?
Checked in this order. The first rule that applies decides.
--no-verificationturns verification off for the whole scan, and it wins over every other setting.- Next, the engine checks for a per-detector override, first for the detector's exact version, then for the detector with any version.
- The open-source CLI never fills in that override map, so in a CLI scan per-detector overrides do nothing.
- Otherwise, the source's own setting decides. The open-source git source is started with verification on.
When two detectors find the same secret
- When more than one detector matches the same chunk, the chunk first goes through an overlap check, unless
--allow-verification-overlapis set. - The first detector to report a secret is verified as usual. If a different detector type then reports the same secret in that chunk, or one more than 90% similar by Levenshtein distance, that later copy is not verified. It is reported with an overlap error, which makes it unknown. Secrets are only compared when their lengths are within about 10% of each other.
- The error says verification was disabled for your safety and names the flag that overrides it.
- This stops one credential from being sent to two different providers, for example a weak generic pattern catching another provider's key.
Verification cache
- Verification results are cached, so a credential seen again in the same scan is usually not checked again. A cache hit counts only when every result in that span is already cached. The cache is on unless
--no-verification-cacheis set. - Results are cached as they come back, errors included, so a secret whose check hit a brief network error likely stays unknown for the rest of the scan.
Custom regex detectors
- Custom regex detectors can verify through your own webhook. TruffleHog sends the matches in a JSON POST request.
- With no status ranges configured, a 200 response means verified.
- If the request gets no response at all, such as a network error, the result is unknown.
- You can also configure success and rotated status ranges, and list several verifiers to try in order. If only one kind of range is set, any other status means the opposite: with success ranges only, a miss means rotated; with rotated ranges only, a miss means verified. If both are set and no verifier's response matches either, the result is unknown. The README does not mention these ranges.
Verification flags
| Flag | What it does |
|---|---|
| --no-verification | Don't verify the results. |
| --results | Which statuses to print: verified, unknown, unverified, filtered_unverified. Default: all three statuses. Choosing filtered_unverified also prints ordinary unverified results, plus unverified results that would otherwise be dropped as likely false positives. |
| --results=verified | Print verified results only. The older --only-verified flag does the same but is hidden from help, and it replaces any --results value you also pass. |
| --allow-verification-overlap | Allow verification of similar credentials across detectors |
| --no-verification-cache | Disable verification caching |
| --verifier | Set custom verification endpoints. |
Noise controls: false positives, entropy, ignore tags and dedupe
- A result that is not verified (unverified or unknown) is dropped as a likely false positive if the secret contains a word from one of 4 built-in word lists or a placeholder such as "example", or is not valid UTF-8. A detector with its own false-positive check uses that check instead.
--results=filtered_unverifiedkeeps these results. --filter-unverified: Only output first unverified result per chunk per detector if there are more than one results. In practice, for each span: if any result is verified, only the verified ones are kept; otherwise one result is kept.--filter-entropy: Filter unverified results with Shannon entropy. Start with 3.0.- For sources that track line numbers, a result is dropped when the line holding the secret contains
trufflehog:ignoreafter the secret.--no-ignore-tagreports it anyway. - Duplicates are matched on job, detector name and type, the raw secret and its location, so the same secret in two places is reported twice. The cache keeps the 5000 most recent results by default, so a repeat that comes after that many other results can print again. 0 turns it off.