ci(gitleaks): gate PRs on their own commits, pin two more false positives - #168
Merged
Merged
Conversation
…ives Every PR in this repo failed gitleaks, whatever it touched. The job ran `gitleaks detect --source .` over full history, so it resolved to a blob committed once and reported it forever — #163 and #166 both went red on a finding neither introduced. A check that is red on arrival stops being read, which is the failure mode that matters here. Pull requests now scan only base..head. History is still scanned in full on push to master and on the weekly cron, so an existing finding cannot be merged out of sight — it just stops masking new ones. Two more false-positive fingerprints. A fingerprint pins one commit, and both already-pinned lines survived later edits to their files, so each matched again under a newer SHA: the pk_test_ fixture the analyzer test asserts on, and the docs curl example that by then read `-H "Authorization: Bearer $SECRET"`. Deliberately still unpinned: the 21 findings in .env.bak-2026-07-28. Those are real credentials, they remain in history, and suppressing them before they are rotated would hide a live exposure. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
ralyodio
added a commit
that referenced
this pull request
Jul 30, 2026
…ives (#168) Every PR in this repo failed gitleaks, whatever it touched. The job ran `gitleaks detect --source .` over full history, so it resolved to a blob committed once and reported it forever — #163 and #166 both went red on a finding neither introduced. A check that is red on arrival stops being read, which is the failure mode that matters here. Pull requests now scan only base..head. History is still scanned in full on push to master and on the weekly cron, so an existing finding cannot be merged out of sight — it just stops masking new ones. Two more false-positive fingerprints. A fingerprint pins one commit, and both already-pinned lines survived later edits to their files, so each matched again under a newer SHA: the pk_test_ fixture the analyzer test asserts on, and the docs curl example that by then read `-H "Authorization: Bearer $SECRET"`. Deliberately still unpinned: the 21 findings in .env.bak-2026-07-28. Those are real credentials, they remain in history, and suppressing them before they are rotated would hide a live exposure. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Every PR in this repo fails
gitleaks, whatever it touches — #163 (an/adsfeature) and #166 (the env-backup removal) both went red on a finding neither introduced.Cause
The job runs
gitleaks detect --source .withfetch-depth: 0, i.e. full history, on every PR. History does not change when a PR changes, so the same blob is reported forever. A check that is red on arrival is a check nobody reads — which is the failure mode that actually matters for a secret scanner.Change
PRs scan
base..headonly. History is still scanned in full on push tomasterand on the existing weekly cron, so an existing finding cannot be merged out of sight — it just stops masking new ones.Two more false-positive fingerprints. A fingerprint pins one commit, and both lines already in
.gitleaksignoresurvived later edits to their files, so each matches again under a newer SHA:2eb14f9b— thepk_test_…publishable key in the sample<script>fixture the analyzer test asserts on508859ed— the docs curl example, by then reading-H "Authorization: Bearer $SECRET", a shell variableDeliberately NOT suppressed
The 21 findings in
.env.bak-2026-07-28(commit925da5e2) — a private key, a GCP API key and 19 API keys. Those are real credentials, still in history. Pinning them before they are rotated would hide a live exposure. The full-history scan stays red on them until they are rotated and the blob is purged, which is correct.Verification
Run locally with gitleaks 8.21.2, the same version CI installs:
.env.bakcredentials.1 commits scanned … no leaks found, exit 0.leaks found: 1, exit 1. (First attempt usedAKIAIOSFODNN7EXAMPLE, which gitleaks allowlists as AWS's own documentation key, so it correctly did not fire.)🤖 Generated with Claude Code