Repository navigation
fix(security): a plain git grep pathspec glob is data, not a self-kill spelling - #34097
chenmingwei23 wants to merge 2 commits into
Conversation
213352e to
bc89979
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: the fix uses the existing What this change shipsInventory (4 items) — 3 justifiedIntent: let an agent run a read-only
[FIRST-PRINCIPLES-REVIEWED] f60af2a Description read[DESCRIPTION-READ] e1daff62fd66b616209b89a714b655c0c35fd3b46cb31bdcea659a629a70f038 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the exemption only relabels the operands of a first-statement, bare- Notes
[DESIGN-REVIEWED] f60af2a Description read[DESCRIPTION-READ] 70946128196e812d8858e6d38c5581ab202865368e18f85cbab8b04e962fb0aa That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/security/shell_normalizer.py:781 -- Command hashing bypasses the new operand exemption
[BLOCK-MERGE] 2214032 Adjudication (Opus 5.5) — is blocking on each finding proportionate?No adjudicable findings; F1 is the only finding, and it is fenced. F1 — unbounded harm (a way around the deny gate's self-kill check). I confirmed it in the code. [ADJUDICATION] 2214032 total=0 uphold=0 downgrade=0 [ADJUDICATION-FENCED] 2214032 fenced=1 flagged=0 False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — 🔴 changes requested (blocking)Reviewed This PR turns the self-kill floor from deny to allow. When BLOCKING — src/kiro_crew/security/shell_normalizer.py:781 Trigger: The agent runs [BLOCK-MERGE] 2214032 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
c090538 to
214a4fc
Compare
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
Security Scope Review -- ✅ PASSWhich legitimate operations does Verdict basis: adjudicated, zero confirmed regressions. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: PASS Reason: This change loosens the gate: it adds a fail-closed data-consumer exemption for the operands of a plain TIGHTENING: No guard got stricter. The diff relabels operands in ADJUDICATED: 18 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: The diff assumes a few spellings: the program word is the bare literal
No platform assumption in the diff is left without a probe. UNADJUDICATED: The exemption leaves out commands that may well be legitimate: [SCOPE-REVIEWED] 2214032 |
214a4fc to
2214032
Compare
Sensitive change review
|
…t path reads as data
…separator ends its pager check
2214032 to
f60af2a
Compare
Sensitive change review
|
|
Withdrawing the Adversarial review found four bypass classes in a row, each defeating the previous guard:
A token-shape rule over one command line cannot prove
|
…#34098) `git grep` runs its pager on the matching files, so a pager option names a program git executes, but the self-kill argv floor did not see it: the command lives inside one option token. Five forms were allowed on main (`-O<cmd>`, a clustered `-nO<cmd>`, a `-c core.pager=<cmd>` global, a `GIT_PAGER=<cmd>` env word, and an array expansion), plus the long `--open-files-in-pager=` option. This adds refusal tests for those forms (red until the fix), keeps a benign pager allowed, and pins as regression guards the shadowing and quoted-separator forms a withdrawn `git grep` operand exemption would have had to defend (the four bypass classes found reviewing #34097). Attack strings are built from parts.
…#34098) `git grep` runs its pager on the matching files, so a pager option names a program git executes, but the self-kill argv floor did not see it: the command lives inside one option token. Five forms were allowed on main (`-O<cmd>`, a clustered `-nO<cmd>`, a `-c core.pager=<cmd>` global, a `GIT_PAGER=<cmd>` env word, and an array expansion), plus the long `--open-files-in-pager=` option. This adds refusal tests for those forms (red until the fix), keeps a benign pager allowed, and pins as regression guards the shadowing and quoted-separator forms a withdrawn `git grep` operand exemption would have had to defend (the four bypass classes found reviewing #34097). Attack strings are built from parts.
|
Closing as withdrawn (2026-11-10 00:1xZ). Adversarial review found four bypass classes in a row (quoted separator, basename-only The refusal tests for all four classes moved into #34233, which refuses a git command that opens or configures a pager. The sound approach to the The branch is kept for reference. |
Problem / Motivation
Goal: a read-only
git grepwhose pathspec glob sits next to a product-named path is no longer refused as a self-kill, and no new way to run a program opens.git grep x -- '*'; ls /w/kirocrewsearches files, then lists a directory. The self-kill argv floor reads the bare*operand, glued to;, as a word that could expand to a kill program, and refuses the whole command.git grepoperands are patterns and pathspecs that git never runs.Why it matters
Agents search with
git grepand pathspecs all the time. A false self-kill denial stops the turn and teaches the agent to avoid a correct, read-only command.Not a goal
-O<cmd>,--open-files-in-pager=<cmd>, a-c core.pager=...or--paginateglobal option, aGIT_PAGER=...word, or an expansion all keep exactly their current verdict.What changed (motivation → approach → change)
_argv_programslabels the operands of a plaingit grepframe as the data consumergit grep, which joins_DATA_CONSUMER_PROGRAMS. The exemption fails closed: it is withheld from every frame unless the whole command line is unambiguous.-O<cmd>,--open-files-in-pager=<cmd>, a clustered-nO, or an expansion), no frame is exempted. A quoted;de-quotes to a token identical to a real;, so the floor cannot tell a separator from data; scanning every token (never stopping at a separator) is what closes that.git grep -e '*' -e <name> -e ';' -O'<cmd>' -- fis refused with the quoted;exactly as without it.GIT_PAGER=or an inlinePATH=word in any frame withholds the exemption.gitonly. The exemption applies only to agit grepthat is the FIRST statement on the line, with its program word exactlygit(not/tmp/gitor./git) andgrepimmediately after it. A literalgitword does not prove git runs the operands: a function, an alias, aPATHchange, ahash -pentry or any other earlier statement can reshadow it. Rather than enumerate those vectors, the exemption fails closed on what the token stream can prove -- that nothing ran before this command. Agit grepthat is not the first statement keeps its normal (un-exempted) verdict.Backwards compatibility
This narrows one false refusal. Every command refused before is still refused, apart from plain
git grepoperands. Nothing that was allowed becomes refused.Tests
test/test_argv_floor_git_grep_pathspec.py, with every attack string assembled from parts:;pager bypass in its glued spellings, plus--paginatewith a later kill.git grepthat opens a pager running a kill is refused with the same verdict with or without a quoted standalone;. A quoted;must not change the answer.git()function, afunction git, aPATH=prefix, ahash -pentry, acommand gitprefix, a&&-chained second statement, and the/tmp/gitand./gitpath forms are each refused. Only agit grepthat is the first statement with the bare literalgitis exempted.-Oafter the pathspec, a clustered-nO,-c core.pager,GIT_PAGER, an array expansion). This change does not touch them; closing them is Self-kill argv floor does not refuse five git grep pager forms #34098.Red first: the test commit (
a6fe17df7, tests only) fails without the fix (the false-positive cases are refused on base). Each bypass was checked againstorigin/main: it refuses the quoted-;pager command and every shadowing form (function, alias,PATH,hash -p,command,&&-chained,/tmp/git,./git), so this change only restores that, it does not widen it. Green: added after the fix commit's (f60af2ab4) run.Manual verification
Each case was judged directly with the security module at three points:
origin/main, the buggy first fix, and this fix. Onorigin/mainthe false positives are refused and every bypass is refused. The buggy first fix allowed the quoted-;pager command and thegit-redefinition forms (the two reviewer findings). This fix refuses every bypass again and allows the false positives, matchingorigin/mainon every bypass.Screenshots / video
N/A: no user-visible UI change.
Pattern harvest
Pattern: a data operand treated as a possible program because the scanner judges it by its shape alone (a glob glued to a separator), without knowing that its program never runs operands.
Rule candidate: an argv scanner labels an operand by the program that consumes it before judging its shape. A known data consumer's operands are never program words, unless an option of that program can run one (for git grep, the pager option). Sibling sites are the other argv scanners that label operands by token shape. The follow-up for the same scanner is #34098.
Related Issues
Follow-up: #34098 (five pager forms the floor does not refuse, strict xfail here).
Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.