Skip to content

Commit bc61b0e

Browse files
committed
fix(ci): use gitleaks dir mode so pre-commit catches secrets in CI
The default gitleaks pre-commit hook entry uses `gitleaks git --pre-commit --staged`, which scans staged git changes. In CI, `pre-commit run --all-files` has no staged files, so gitleaks scans 0 commits and always passes — even when secrets are present in the codebase. Switch to `gitleaks dir --redact --verbose` which scans actual file contents. This works correctly both during local `git commit` hooks and in CI with `--all-files`. Signed-off-by: svc-bionemo <267129667+svc-bionemo@users.noreply.github.com>
1 parent 8593a34 commit bc61b0e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ repos:
4444
rev: v8.24.2
4545
hooks:
4646
- id: gitleaks
47+
# Override default entry: `gitleaks git --pre-commit --staged` only
48+
# scans staged commits, which is a no-op in CI (`pre-commit run
49+
# --all-files`). `gitleaks dir` scans file contents directly, so it
50+
# catches secrets both locally and in CI.
51+
entry: gitleaks dir --redact --verbose

0 commit comments

Comments
 (0)