Skip to content

ci: scan only the checked-out history with gitleaks - #241

Merged
ElbertePlinio merged 2 commits into
mainfrom
ci/236-gitleaks-scope
Oct 3, 2026
Merged

ElbertePlinio merged 2 commits into
mainfrom
ci/236-gitleaks-scope

Conversation

@ElbertePlinio

@ElbertePlinio ElbertePlinio commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

The gitleaks job scanned git log --all, and fetch-depth: 0 fetches every remote branch, so each PR scanned every other branch with main's .gitleaks.toml. A branch that adds an allowlisted fixture (currently feat/207-pip-viewer, PR #225) failed every other PR. The job now passes --log-opts=HEAD. On a pull request HEAD is the merge commit, so the scan covers main plus the PR's own commits with the PR's own config. On a push to main it covers the full history of main. The allowlist policy is unchanged.

One tradeoff: a branch with no open PR is no longer scanned incidentally by other PRs. It is scanned when it gets a PR, and again on main when it merges.

Closes #236

Requirement Verified by Scenario Result Evidence
PR result depends only on the commits it would merge and its own config Manual check, CI Fresh clone with all 102 remote branches, detached simulated merge of origin/main and this branch. Old command: 447 commits, 24 findings from feat/207-pip-viewer. New command: 211 commits, no leaks Pass ~/.cache/kickoff-236/sol-1/last-message.md
main pushes still scan the full history of main Manual check New command on origin/main alone: 210 non-merge commits scanned, no leaks. With fetch-depth: 0, HEAD on a push to main is the tip of main Pass ~/.cache/kickoff-236/sol-1/last-message.md
Real findings in HEAD history are still reported Manual check Throwaway clone with a committed fake AWS key outside the allowlist: new command reports 1 aws-access-token finding and exits 1 Pass ~/.cache/kickoff-236/sol-1/last-message.md
Exact-value allowlist policy unchanged Diff Allowlist entries untouched; the only .gitleaks.toml change is its first comment line, which now describes the new scan scope Pass diff (TOML parses)
Confirm with a branch that adds an allowlisted fixture while another PR is open CI on this PR PR #225 is open and adds the RFC 6455 fixture with its own allowlist; this PR's gitleaks check must pass See checks this PR's checks

There is nothing to drive in a device pass. The change is CI configuration, and the scenarios above exercise it directly. Workflow YAML parses; actionlint is not installed here.

@ElbertePlinio
ElbertePlinio merged commit 747b7cf into main Oct 3, 2026
5 checks passed
@ElbertePlinio
ElbertePlinio deleted the ci/236-gitleaks-scope branch October 3, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: gitleaks fails unrelated PRs on fixtures from other branches

1 participant