Skip to content

Find, verify, and analyze leaked credentials

Update PreCommit.md with audit mode details (#4280)

joeleonjrc1fd84c41575
diff --git a/PreCommit.md b/PreCommit.md
index 4811e25e6..6e66097cc 100644
--- a/PreCommit.md
+++ b/PreCommit.md
@@ -160,6 +160,24 @@ In rare cases, you may need to bypass pre-commit hooks:
git commit --no-verify -m "Your commit message"
```
+### Running in Audit Mode
+
+You can run the TruffleHog pre-commit hook in an "audit" or "non-enforcement" mode to test the git hook with the following commands:
+
+Local Binary Version:
+```bash
+trufflehog git file://. --since-commit HEAD --results=verified,unknown 2>/dev/null
+```
+
+Docker Container Version:
+```bash
+docker run --rm -v "$(pwd):/workdir" -i --rm trufflesecurity/trufflehog:latest git file:///workdir --since-commit HEAD --results=verified,unknown 2>/dev/null
+```
+
+This change does two things: (1) removes the `--fail` flag, which means the pre-commit hook will *always* pass, (2) suppresses `stderr` output, so only verified secrets are printed to the terminal output.
+
+**For users of the Pre-Commit Framework: add the `verbose: true` flag during audit mode; otherwise, the hook will pass, and you won't see any secrets.**
+
## Troubleshooting
### Hook Not Running