Skip to content

fix(leak-scan): replace --files-at-commit with gitleaks git --log-opts for pr-diff mode#75

Merged
jorisjonkers-dev-agents[bot] merged 2 commits into
mainfrom
fix/gitleaks-files-at-commit-flag
Jul 12, 2026
Merged

fix(leak-scan): replace --files-at-commit with gitleaks git --log-opts for pr-diff mode#75
jorisjonkers-dev-agents[bot] merged 2 commits into
mainfrom
fix/gitleaks-files-at-commit-flag

Conversation

@jorisjonkers-dev-agents

Copy link
Copy Markdown
Contributor

Summary

  • gitleaks 8.30.1 removed --files-at-commit and --include-paths from the detect subcommand; passing either flag causes gitleaks to print help text and exit 1, breaking every PR pipeline run.
  • Replaces the pr-diff gitleaks invocation with gitleaks git --log-opts="${BASE_REF}..${HEAD_REF}", which is the correct v8 API for scanning a commit range and preserves the pr-diff mode intent (only secrets introduced in the PR).
  • Adds T-D2 and T-D7g regression guards: assert the correct gitleaks git --log-opts form is present and the removed --files-at-commit/--include-paths flags are absent.

Root cause

The same class of v8 CLI drift fixed in PR #67 (--all--log-opts="--all"). The pr-diff scan path was missed in that fix.

Verified

  • All 157 tests pass locally.
  • gitleaks 8.30.1 installed from pinned SHA and CLI verified: gitleaks detect --files-at-commitError: unknown flag; gitleaks git --log-opts=BASE..HEAD → scans correctly.

…s for pr-diff mode

gitleaks 8.30.1 removed --files-at-commit and --include-paths from the
detect subcommand; both flags cause gitleaks to print help and exit 1,
breaking every PR pipeline run.

The correct v8 replacement for pr-diff scanning is:
  gitleaks git --log-opts="BASE..HEAD" --redact --report-path=... .

This scans only the commits introduced in the PR, preserving the
pr-diff mode's documented intent (secrets in changed code only).

Adds T-D2 and T-D7g regression guards asserting the correct flag form
is present and the removed flags are absent.
@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot added the type: bug Something is broken or behaving incorrectly. label Jul 12, 2026
…iff scan

The initial fix replaced --files-at-commit with gitleaks git --log-opts but
did not carry over EXCLUDE_PATHS filtering to the gitleaks invocation.
gitleaks 8.x has no --include-paths flag, so excluded prefixes are now
expressed via a temporary gitleaks config with [allowlist].paths entries
that are generated from EXCLUDE_PATHS and cleaned up after the scan.
@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot merged commit 4be901c into main Jul 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something is broken or behaving incorrectly.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant