Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ repos:
- id: trufflehog
name: TruffleHog Secret Scanner
description: Detect secrets in your data before committing
entry: >-
bash -c 'command -v trufflehog >/dev/null 2>&1 &&
trufflehog git file://. --since-commit HEAD --results=verified,unknown --fail ||
echo "TruffleHog not installed - skipping"'
# Scan staged files only. The git-history mode (--since-commit HEAD) also
# traverses fetched remote branches in the local object store, producing
# false positives from unmerged branches. Staged-file scanning is the
# correct scope for a pre-commit hook; git history scanning belongs in CI.
entry: bash -c 'command -v trufflehog >/dev/null 2>&1 && (git diff --cached -z --diff-filter=d --name-only 2>/dev/null | xargs -0 -r trufflehog filesystem --fail --no-update --results=verified,unknown) || echo "TruffleHog not installed - skipping secret scan"'
language: system
pass_filenames: false
stages: [pre-commit]
Expand Down
Loading