Repository navigation
fix(constraints): report floor-guard findings by file and line, not line text - #806
Merged
addyosmani merged 1 commit intoNov 24, 2026
Conversation
…ine text The reference promises to report the rule and the location, never the matched secret value, but flag() kept the first 120 characters of the matched diff line and the report printed them to stderr. A suppressed or TODO line is often the one holding a secret-like value. Findings now carry file:line, numbered from the @@ hunk headers. Removed lines are named and numbered as in the base and marked (removed). Context lines (diff.interHunkContext) are counted so numbers stay right, and the trailing tab git adds to paths with spaces is stripped. Fixes addyosmani#804
addyosmani
approved these changes
Nov 24, 2026
addyosmani
left a comment
Owner
There was a problem hiding this comment.
praise: the reference promised never to print the matched value and then printed the line. file:line is what a reviewer needs anyway. Thanks.
hillemacher
pushed a commit
to hillemacher/agent-skills
that referenced
this pull request
Dec 1, 2026
fix(constraints): report floor-guard findings by file and line, not line text
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.
Fixes #804
The floor-guard reference says it "reports the rule and the location, never the matched secret value", but
flag()kept the first 120 characters of the matched diff line and the report printed them to stderr. So a value on a// gitleaks:allowor// TODO KEY=...line ended up in terminal output and agent logs.Findings now carry
file:line, numbered from the@@hunk headers. Removed lines are named and numbered as in the base and marked(removed), a deleted test reads(file deleted), and a threshold change readsbase -> new. Detection, exit codes and the hint text are unchanged.Before (throwaway repo, placeholder values):
After:
Context lines are counted, so numbers stay right when
diff.interHunkContextis set (git then prints context between nearby hunks even with--unified=0).One separate fix, flagged so you can ask me to split it out:
pathOfnow strips the trailing tab git adds to a header path that contains a space. Without it the tab lands insidefile:line, and it also meant aCONSTRAINTS.mdunder such a path never matchedisConstraints, so a loosened threshold inmy dir/CONSTRAINTS.mdwent unreported (1 finding before, 2 after on the same diff). Happy to move this one line to its own PR.Checked on node 22 and git 2.34 with throwaway repos: multi-hunk edits, a missing final newline, an untracked file, a deleted test file, a detected rename, a new exception row, a rule removed, a rule moved between two
CONSTRAINTS.mdfiles,diff.interHunkContext=5, and a path with a space. Same findings and exit codes as before in every case, with no line text in the output.I left the rule labels out of threshold findings so nothing from the line is printed, and did not add sentinel fixtures to the reference, to keep it a clean copyable file. Happy to add either if you want them.
This touches the same diff-walk lines as #650; I can rebase on whichever lands first.