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
ci: fix Gitleaks — PR mode scans only PR commits, not full history
The baseline approach (scanning full history + skipping known findings)
was fragile: CI's merge-checkout includes commits that differ from the
local clone used to generate the baseline, causing 2 unmatched
fingerprints.
Better architecture:
- PR mode: `gitleaks detect --log-opts="base_sha..HEAD"` scans ONLY
the commits in the PR. Historical secrets are naturally ignored since
they were introduced in older commits not in the PR's range.
- Push-to-main mode: `--log-opts="before..HEAD"` scans only the pushed
commits. Falls back to baseline if the before-SHA is unavailable
(e.g. new branch push).
This matches how professional secret scanning works: check what's new,
not what's old. The .gitleaksbaseline is kept for the push-to-main
fallback path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments