Skip to content

Commit 62bd8df

Browse files
rgmzrosecodym
andauthored
feat: replace --only-verified with --results in docs/precommit (#3643)
Co-authored-by: Cody Rose <[email protected]>
1 parent 710d09b commit 62bd8df

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

β€Ž.pre-commit-hooks.yamlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- id: trufflehog
22
name: TruffleHog
33
description: Detect secrets in your data with TruffleHog.
4-
entry: trufflehog git file://. --since-commit HEAD --only-verified --fail
4+
entry: trufflehog git file://. --since-commit HEAD --results=verified --fail
55
language: golang
6-
pass_filenames: false
6+
pass_filenames: false

β€ŽREADME.mdβ€Ž

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ This required Cosign binary to be installed prior to running installation script
185185
Command:
186186

187187
```bash
188-
trufflehog git https://github.com/trufflesecurity/test_keys --only-verified
188+
trufflehog git https://github.com/trufflesecurity/test_keys --results=verified,unknown
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 --only-verified
212+
trufflehog github --org=trufflesecurity --results=verified,unknown
213213
```
214214

215215
## 3: Scan a GitHub Repo for only verified keys and get JSON output
216216

217217
Command:
218218

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

223223
Expected output:
@@ -236,7 +236,7 @@ trufflehog github --repo=https://github.com/trufflesecurity/test_keys --issue-co
236236
## 5: Scan an S3 bucket for verified keys
237237

238238
```bash
239-
trufflehog s3 --bucket=<bucket name> --only-verified
239+
trufflehog s3 --bucket=<bucket name> --results=verified,unknown
240240
```
241241

242242
## 6: Scan S3 buckets using IAM Roles
@@ -272,23 +272,23 @@ $ trufflehog git file://test_keys --only-verified
272272
## 10: Scan GCS buckets for verified secrets
273273

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

278278
## 11: Scan a Docker image for verified secrets
279279

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

282282
```bash
283-
trufflehog docker --image trufflesecurity/secrets --only-verified
283+
trufflehog docker --image trufflesecurity/secrets --results=verified,unknown
284284
```
285285

286286
## 12: Scan in CI
287287

288288
Set the `--since-commit` flag to your default branch that people merge into (ex: "main"). Set the `--branch` flag to your PR's branch name (ex: "feature-1"). Depending on the CI/CD platform you use, this value can be pulled in dynamically (ex: [CIRCLE_BRANCH in Circle CI](https://circleci.com/docs/variables/) and [TRAVIS_PULL_REQUEST_BRANCH in Travis CI](https://docs.travis-ci.com/user/environment-variables/)). If the repo is cloned and the target branch is already checked out during the CI/CD workflow, then `--branch HEAD` should be sufficient. The `--fail` flag will return an 183 error code if valid credentials are found.
289289

290290
```bash
291-
trufflehog git file://. --since-commit main --branch feature-1 --only-verified --fail
291+
trufflehog git file://. --since-commit main --branch feature-1 --results=verified,unknown --fail
292292
```
293293

294294
## 13: Scan a Postman workspace
@@ -429,7 +429,7 @@ Flags:
429429
--github-actions Output in GitHub Actions format.
430430
--concurrency=20 Number of concurrent workers.
431431
--no-verification Don't verify the results.
432-
--only-verified Only output verified results.
432+
--results=RESULTS Specifies which type(s) of results to output: verified, unknown, unverified, filtered_unverified. Defaults to all types.
433433
--allow-verification-overlap
434434
Allow verification of similar credentials across detectors
435435
--filter-unverified Only output first unverified result per chunk per detector if there are more than one results.
@@ -526,7 +526,7 @@ jobs:
526526
- name: Secret Scanning
527527
uses: trufflesecurity/trufflehog@main
528528
with:
529-
extra_args: --only-verified
529+
extra_args: --results=verified,unknown
530530
```
531531

532532
In the example config above, we're scanning for live secrets in all PRs and Pushes to `main`. Only code changes in the referenced commits are scanned. If you'd like to scan an entire branch, please see the "Advanced Usage" section below.
@@ -553,7 +553,7 @@ If you're incorporating TruffleHog into a standalone workflow and aren't running
553553
fetch-depth: ${{env.depth}}
554554
- uses: trufflesecurity/trufflehog@main
555555
with:
556-
extra_args: --only-verified
556+
extra_args: --results=verified,unknown
557557
...
558558
```
559559

@@ -578,7 +578,7 @@ TruffleHog statically detects [https://canarytokens.org/](https://canarytokens.o
578578
# Scan commits until here (usually dev branch).
579579
head: # optional
580580
# Extra args to be passed to the trufflehog cli.
581-
extra_args: --log-level=2 --only-verified
581+
extra_args: --log-level=2 --results=verified,unknown
582582
```
583583
584584
If you'd like to specify specific `base` and `head` refs, you can use the `base` argument (`--since-commit` flag in TruffleHog CLI) and the `head` argument (`--branch` flag in the TruffleHog CLI). We only recommend using these arguments for very specific use cases, where the default behavior does not work.
@@ -591,7 +591,7 @@ If you'd like to specify specific `base` and `head` refs, you can use the `base`
591591
with:
592592
base: ""
593593
head: ${{ github.ref_name }}
594-
extra_args: --only-verified
594+
extra_args: --results=verified,unknown
595595
```
596596
597597
## TruffleHog GitLab CI
@@ -612,7 +612,7 @@ security-secrets:
612612
- apk add --no-cache git curl jq
613613
- curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin
614614
script:
615-
- trufflehog filesystem "$SCAN_PATH" --only-verified --fail --json | jq
615+
- trufflehog filesystem "$SCAN_PATH" --results=verified,unknown --fail --json | jq
616616
rules:
617617
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
618618
```
@@ -637,9 +637,9 @@ repos:
637637
- id: trufflehog
638638
name: TruffleHog
639639
description: Detect secrets in your data.
640-
entry: bash -c 'trufflehog git file://. --since-commit HEAD --only-verified --fail'
640+
entry: bash -c 'trufflehog git file://. --since-commit HEAD --results=verified,unknown --fail'
641641
# For running trufflehog in docker, use the following entry instead:
642-
# entry: bash -c 'docker run --rm -v "$(pwd):/workdir" -i --rm trufflesecurity/trufflehog:latest git file:///workdir --since-commit HEAD --only-verified --fail'
642+
# entry: bash -c 'docker run --rm -v "$(pwd):/workdir" -i --rm trufflesecurity/trufflehog:latest git file:///workdir --since-commit HEAD --results=verified,unknown --fail'
643643
language: system
644644
stages: ["commit", "push"]
645645
```
@@ -678,7 +678,7 @@ detectors:
678678
```
679679

680680
```
681-
$ trufflehog filesystem /tmp --config config.yaml --only-verified
681+
$ trufflehog filesystem /tmp --config config.yaml --results=verified,unknown
682682
πŸ·πŸ”‘πŸ· TruffleHog. Unearth your secrets. πŸ·πŸ”‘πŸ·
683683

684684
Found verified result πŸ·πŸ”‘

β€Žmain.goβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ var (
5353
gitHubActionsFormat = cli.Flag("github-actions", "Output in GitHub Actions format.").Bool()
5454
concurrency = cli.Flag("concurrency", "Number of concurrent workers.").Default(strconv.Itoa(runtime.NumCPU())).Int()
5555
noVerification = cli.Flag("no-verification", "Don't verify the results.").Bool()
56-
onlyVerified = cli.Flag("only-verified", "Only output verified results.").Bool()
57-
results = cli.Flag("results", "Specifies which type(s) of results to output: verified, unknown, unverified. Defaults to all types.").Hidden().String()
56+
onlyVerified = cli.Flag("only-verified", "Only output verified results.").Hidden().Bool()
57+
results = cli.Flag("results", "Specifies which type(s) of results to output: verified, unknown, unverified, filtered_unverified. Defaults to all types.").String()
5858

5959
allowVerificationOverlap = cli.Flag("allow-verification-overlap", "Allow verification of similar credentials across detectors").Bool()
6060
filterUnverified = cli.Flag("filter-unverified", "Only output first unverified result per chunk per detector if there are more than one results.").Bool()

0 commit comments

Comments
Β (0)