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 intoJul 12, 2026
Conversation
…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.
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gitleaks 8.30.1removed--files-at-commitand--include-pathsfrom thedetectsubcommand; passing either flag causes gitleaks to print help text and exit 1, breaking every PR pipeline run.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).gitleaks git --log-optsform is present and the removed--files-at-commit/--include-pathsflags 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
gitleaks 8.30.1installed from pinned SHA and CLI verified:gitleaks detect --files-at-commit→Error: unknown flag;gitleaks git --log-opts=BASE..HEAD→ scans correctly.