Skip to content

Commit 38a5381

Browse files
committed
Clarify what 'unknown' means
1 parent 466da5b commit 38a5381

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ This requires Cosign binary to be installed prior to running the installation sc
185185
Command:
186186

187187
```bash
188-
trufflehog git https://github.com/trufflesecurity/test_keys --results=verified,unknown
188+
trufflehog git https://github.com/trufflesecurity/test_keys --results=verified
189189
```
190190

191191
Expected output:
@@ -209,15 +209,15 @@ Timestamp: 2022-06-16 10:17:40 -0700 PDT
209209
## 2: Scan a GitHub Org for only verified secrets
210210

211211
```bash
212-
trufflehog github --org=trufflesecurity --results=verified,unknown
212+
trufflehog github --org=trufflesecurity --results=verified
213213
```
214214

215-
## 3: Scan a GitHub Repo for only verified keys and get JSON output
215+
## 3: Scan a GitHub Repo for only verified secrets and get JSON output
216216

217217
Command:
218218

219219
```bash
220-
trufflehog git https://github.com/trufflesecurity/test_keys --results=verified,unknown --json
220+
trufflehog git https://github.com/trufflesecurity/test_keys --results=verified --json
221221
```
222222

223223
Expected output:
@@ -233,7 +233,7 @@ Expected output:
233233
trufflehog github --repo=https://github.com/trufflesecurity/test_keys --issue-comments --pr-comments
234234
```
235235

236-
## 5: Scan an S3 bucket for verified keys
236+
## 5: Scan an S3 bucket for high-confidence results (verified + unknown)
237237

238238
```bash
239239
trufflehog s3 --bucket=<bucket name> --results=verified,unknown
@@ -269,25 +269,25 @@ Run trufflehog from the parent directory (outside the git repo).
269269
$ trufflehog git file://test_keys --results=verified,unknown
270270
```
271271

272-
## 10: Scan GCS buckets for verified secrets
272+
## 10: Scan GCS buckets for only verified secrets
273273

274274
```bash
275-
trufflehog gcs --project-id=<project-ID> --cloud-environment --results=verified,unknown
275+
trufflehog gcs --project-id=<project-ID> --cloud-environment --results=verified
276276
```
277277

278-
## 11: Scan a Docker image for verified secrets
278+
## 11: Scan a Docker image for only verified secrets
279279

280280
Use the `--image` flag multiple times to scan multiple images.
281281

282282
```bash
283283
# to scan from a remote registry
284-
trufflehog docker --image trufflesecurity/secrets --results=verified,unknown
284+
trufflehog docker --image trufflesecurity/secrets --results=verified
285285

286286
# to scan from the local docker daemon
287-
trufflehog docker --image docker://new_image:tag --results=verified,unknown
287+
trufflehog docker --image docker://new_image:tag --results=verified
288288

289289
# to scan from an image saved as a tarball
290-
trufflehog docker --image file://path_to_image.tar --results=verified,unknown
290+
trufflehog docker --image file://path_to_image.tar --results=verified
291291
```
292292

293293
## 12: Scan in CI
@@ -389,7 +389,7 @@ aws s3 cp s3://example/gzipped/data.gz - | gunzip -c | trufflehog stdin
389389
- Why is the scan taking a long time when I scan a GitHub org
390390
- Unauthenticated GitHub scans have rate limits. To improve your rate limits, include the `--token` flag with a personal access token
391391
- It says a private key was verified, what does that mean?
392-
- Check out our Driftwood blog post to learn how to do this, in short we've confirmed the key can be used live for SSH or SSL [Blog post](https://trufflesecurity.com/blog/driftwood-know-if-private-keys-are-sensitive/)
392+
- A verified result means TruffleHog confirmed the credential is valid by testing it against the service's API. For private keys, we've confirmed the key can be used live for SSH or SSL authentication. Check out our Driftwood blog post to learn more [Blog post](https://trufflesecurity.com/blog/driftwood-know-if-private-keys-are-sensitive/)
393393
- Is there an easy way to ignore specific secrets?
394394
- If the scanned source [supports line numbers](https://github.com/trufflesecurity/trufflehog/blob/d6375ba92172fd830abb4247cca15e3176448c5d/pkg/engine/engine.go#L358-L365), then you can add a `trufflehog:ignore` comment on the line containing the secret to ignore that secrets.
395395

@@ -405,7 +405,13 @@ TruffleHog v3 is a complete rewrite in Go with many new powerful features.
405405

406406
## What is credential verification?
407407

408-
For every potential credential that is detected, we've painstakingly implemented programmatic verification against the API that we think it belongs to. Verification eliminates false positives. For example, the [AWS credential detector](pkg/detectors/aws/aws.go) performs a `GetCallerIdentity` API call against the AWS API to verify if an AWS credential is active.
408+
For every potential credential that is detected, we've painstakingly implemented programmatic verification against the API that we think it belongs to. Verification eliminates false positives and provides three result statuses:
409+
410+
- **verified**: Credential confirmed as valid and active by API testing
411+
- **unverified**: Credential detected but not confirmed valid (may be invalid, expired, or verification disabled)
412+
- **unknown**: Verification attempted but failed due to errors, such as a network or API failure
413+
414+
For example, the [AWS credential detector](pkg/detectors/aws/aws.go) performs a `GetCallerIdentity` API call against the AWS API to verify if an AWS credential is active.
409415

410416
# :memo: Usage
411417

@@ -444,7 +450,7 @@ Flags:
444450
--github-actions Output in GitHub Actions format.
445451
--concurrency=20 Number of concurrent workers.
446452
--no-verification Don't verify the results.
447-
--results=RESULTS Specifies which type(s) of results to output: verified, unknown, unverified, filtered_unverified. Defaults to all types.
453+
--results=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 all types.
448454
--allow-verification-overlap
449455
Allow verification of similar credentials across detectors
450456
--filter-unverified Only output first unverified result per chunk per detector if there are more than one results.
@@ -677,7 +683,7 @@ webhook is used containing the regular expression matches.
677683
678684
TruffleHog will send a JSON POST request containing the regex matches to a
679685
configured webhook endpoint. If the endpoint responds with a `200 OK` response
680-
status code, the secret is considered verified.
686+
status code, the secret is considered verified. If verification fails due to network/API errors, the result is marked as unknown.
681687

682688
Custom Detectors support a few different filtering mechanisms: entropy, regex targeting the entire match, regex targeting the captured secret,
683689
and excluded word lists checked against the secret (captured group if present, entire match if capture group is not present). Note that if

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var (
5858
concurrency = cli.Flag("concurrency", "Number of concurrent workers.").Default(strconv.Itoa(runtime.NumCPU())).Int()
5959
noVerification = cli.Flag("no-verification", "Don't verify the results.").Bool()
6060
onlyVerified = cli.Flag("only-verified", "Only output verified results.").Hidden().Bool()
61-
results = cli.Flag("results", "Specifies which type(s) of results to output: verified, unknown, unverified, filtered_unverified. Defaults to verified,unverified,unknown.").String()
61+
results = cli.Flag("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.").String()
6262
noColor = cli.Flag("no-color", "Disable colorized output").Bool()
6363
noColour = cli.Flag("no-colour", "Alias for --no-color").Hidden().Bool()
6464

0 commit comments

Comments
 (0)