You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gitleaks job scans every branch, so one branch's finding fails every open PR's Secret Scan #1024
security.yml's gitleaks job checks out with fetch-depth: 0, which fetches every branch, and then runs gitleaks detect --source .. That scans the history of every fetched ref (git log --all), not just the PR's commits plus main.
What I saw: #1011 (fix/1004) failed Secret Scan with a finding in internal/hermetic/hermetic.go:76 from commit 4453716 ("Make unit tests hermetic ... (#968)"). That commit was on the then-head of fix/968 (#1003), not on fix/1004 or main. fix/1015 failed at the same time, probably for the same reason. Once fix/968 was force-pushed past it, re-running #1011's job passed with no change to #1011.
So one PR that contains a gitleaks hit, real or false positive, turns every other PR's Secret Scan red while it exists. That trains people to re-run the job until it passes. A commit that is later force-pushed away also stops being scanned, which undercuts the "leaked-then-removed secrets are caught" goal for unmerged branches.
Suggested: on pull_request, scan the PR's own range (gitleaks detect --log-opts="origin/${{ github.base_ref }}..HEAD", or git log over base..head). Keep the full-history scan on push to main / on a schedule, scoped to main's history.
Activity
Scope the gitleaks scan to HEAD's history (#1024)