Say what a gitleaks finding means when it fires - #321
Merged
Conversation
gitleaks scans commits, not the checked-out files, and the failure does not say so. Removing the value and committing the removal leaves the introducing commit on the branch, so the check fails again with the same finding and reads like the fix was not picked up. That cost three CI rounds here, two of them spent editing a working tree that was already clean. Adds a step that runs only on failure and explains it, plus a guide section with the same content for anyone searching after the fact. Both give the procedure to remove the commit, and both say to rebase before collapsing commits: a `git reset --soft origin/main` onto a main that has moved silently reverts what was merged in between, which has already happened once here.
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.
gitleaks detectscans the commits reachable from HEAD, not the checked-out files, and nothing in the failure says so. Remove the offending value, commit the removal, push, and the check fails again with the same finding, because the commit that introduced it is still on the branch. The fix looks like it was not picked up. That cost three CI rounds on #305, two of them spent editing a working tree that was already clean: run33710943701failed at a commit whose tree contained zero matches.This does not change what is scanned. The current scope is right, and narrowing it to the diff would miss exactly what this check exists for, which is a secret added in one commit and deleted in a later one on the same branch. What changes is that a failure now explains itself, in a step gated on
if: failure()and in a contributor-guide section for anyone searching after the fact. Both give the procedure for removing the commit rather than the value.Both also say to rebase before collapsing commits.
git reset --soft origin/mainmoves the branch to wherever main points now while keeping the working tree, so on a main that has advanced the resulting single commit reverts everything merged in between, silently, because the author's own files are all still correct. That happened here: 125 lines from two merged pull requests were undone that way while clearing this very finding, and the only signal was a diffstat with far more deletions than the change could account for. The guide names the two commands that catch it.On the claim that one branch's value blocks the whole repository. That was reported, and I initially repeated it. It is not true, and the correction took two passes worth recording. Run logs first showed other branches passing while mine failed, which argued against it. A local reproduction then appeared to confirm contamination, and I nearly rewrote the scope on that basis: with a
git clone, every branch becomes a local ref,gitleaksreads them all, and a finding on someone else's branch fails yours. But that is not the shapeactions/checkoutproduces. Onpull_requestit fetches only the PR ref, so no other branch is present to read. Reproducing that shape gives no finding, and the run logs settle it independently: each pull request scans main's commit count plus its own (289 + n at the time), never the repository total.fetch-depth: 0means all of this ref's history, not all branches. The comment and the guide now state that with the evidence attached, since the wrong guess is the intuitive one.Verified: the explainer script extracted from the YAML and executed, so the heredoc renders and carries each key instruction; the workflow parses;
docs-uatlint clean; a docs-site production build with no new broken anchors; ko-style and em-dash clean.