Repository navigation
Conversation
Sensitive change review
|
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the floor reads a real shell command line, the fix reuses the existing kill check on the pager git would run, and nothing is taken away. Notes
[DESIGN-REVIEWED] 72f922e Description read[DESCRIPTION-READ] b940c285ec473fb7eb9464fc8c9dc10213ab188ed83eb299c41f9473e8d00f73 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The five spellings in #34098 are real gaps, and no OS control covers them (the sandbox deliberately adds no PID namespace). The excess past the Goal can be deleted later, so it is a note rather than a block. Notes
What this change shipsInventory (10 items) — 7 justifiedIntent: stop an agent killing its own gateway through a
[FIRST-PRINCIPLES-REVIEWED] 72f922e Description read[DESCRIPTION-READ] 9056239dd2656560d36c02c398a81e56c124a73c8b1e7a50b9a7bac8364d59cd That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — 🔴 changes requested (blocking)Reviewed
BLOCKING — src/kiro_crew/security/argv_floor_pager.py:950 Trigger: [BLOCK-MERGE] 72f922e Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
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/argv_floor_pager.py:405 -- Subshell assignments erase the parent’s killing pager
BLOCKING -- src/kiro_crew/security/argv_floor_pager.py:408 -- Quoted command words overwrite assignment state
BLOCKING -- src/kiro_crew/security/argv_floor_pager.py:189 -- Expansion boundaries change Git’s option semantics
BLOCKING -- src/kiro_crew/security/argv_floor_pager.py:733 -- Unconditional writes retain obsolete killing candidates
[BLOCK-MERGE] 72f922e |
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 adds a pager read to the self-kill argv floor. The read sits inside the TIGHTENING: the self-kill floor ( ADJUDICATED: 34 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix (29 rows) probes the parts of git and bash grammar the diff now models:
windows (5 rows) covers the spellings the diff assumes differently there:
Not probed by any row:
UNADJUDICATED: Some refusals in
A shell row could probe these, but a realistic legitimate input for them needs a generated script with more than 8 conditional reassignments of a grep option array that also carries an [SCOPE-REVIEWED] 72f922e |
ad76aa1 to
cd866f6
Compare
Sensitive change review
|
cd866f6 to
d7ad17c
Compare
Sensitive change review
|
Code change approver recommendation: Request changesWhy: the decider found 2 problems and estimates an 80% chance that this change introduces a defect, at or above the 80% level where it asks for changes. The PR adds a large git grep pager reader to the self-kill floor. The code confirms an admitted regression: once past the candidate caps, any literal -O cluster such as -Ocat gets the command refused, while main allows it. This breaks the stated 'no ordinary git grep newly refused' goal, and the CI security-scope adjudication failed with newly-refused candidates. Simple substitution spellings also appear to bypass the new check. Requesting changes. Problems found:
An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
1d20dfc to
4c4576b
Compare
Sensitive change review
|
4c4576b to
a5f6d2b
Compare
Sensitive change review
|
Sensitive change review
|
|
@bolichen97 a maintainer ruling is needed on head 7721537 before this PR changes again. GPT 6.1 blocks on three false refusals: commands origin/main allows and this PR refuses. All three are already listed in the description.
Which do you want?
No code change or push is planned until you pick. |
Sensitive change review
|
|
Rebase only: The re-run lanes on this head, for the open ruling (comment 6865561673):
Backend Tests shard 3 is main's red #37243 ( |
Sensitive change review
|
|
Rebased again for the line budget: head New on this head, all left for the open ruling (comment 6865561673), not fixed here:
|
Sensitive change review
|
|
Rebase only: head
No rule changed. The open ruling (comment 6865561673) is unchanged. |
|
Backend Tests (3.12, 6) is red on |
Sensitive change review
|
|
Head |
|
Rebase only: head |
Sensitive change review
|
Sensitive change review
|
|
Head |
|
GPT 6.1 F4 on The pager check walks payloads with main's shared
So the echo row is refused for the same reason main refuses the echo-wrapped |
git grep runs a pager over the matching files, taken from -O / --open-files-in-pager, a -c core.pager= / pager.grep= global option, or GIT_PAGER / PAGER in the environment. The self-kill argv floor read pkill/killall only as a command word, so a kill handed to git as a pager was allowed. Parse the pager the way git parses the invocation (skip the value of -e/-f, split on the command boundary) and refuse it when it kills the product. No new or widened regex. Fixes #34098
Sensitive change review
|
Problem / Motivation
Goal: a
git grepwhose pager would kill the product is refused by the self-kill floor, in each of the five spellings #34098 lists, with no ordinarygit grepnewly refused.git grepruns a pager over the matching files. The pager is taken from-O/--open-files-in-pager, a-c core.pager=/-c pager.grep=global option, orGIT_PAGER/PAGERin the environment. The self-kill argv floor readspkill/killallonly as a word of the command line, so a kill handed to git as a pager was judged allowed. Each of the five forms in #34098 returnedNonefromsecurity.is_deniedon main.Why it matters
The self-kill floor stops an agent from terminating the gateway that runs it. These forms get around it with one
git grepcall.Not a goal
git log/git showpagers. The issue scopes this togit grep.pager.<alias>key for a user-defined alias.-c pager.grep=is in scope and handled exactly like-c core.pager=; values set outside thegitcommand ("$x",export,--config-envwith an unseen variable) are known limitations (below), not non-goals.BASH -c,Sh -c) bypass non-kill deny rules on main; that is out of scope here. The shell-name fold this PR adds is used only by the self-kill floor's pager read.git grep(patterns,-e/-fvalues, pathspecs, a non-killing pager) keeps its current verdict.Intended? / Repro
Intended? No. Nothing in
docs/system-specs/modules/security.md, the floor's docstrings or git history says a pager kill should pass. #34097 (chenmingwei23's draft) pins these five forms as strictxfailagainst its own test file and the issue says the fix should turn each into a refusal. On main the kill check is_is_self_killinsrc/kiro_crew/security/argv_floor_self.py: it tests each token with_is_kill_by_name_program, and a pager value such as the token-Opkill -f kirocrew #orcore.pager=pkill -f kirocrewnever haspkillas its basename.Repro (origin/main @
ddb535e187): I calledsecurity.is_denieddirectly from a small script, without running the test suite. With<K>a by-name kill program and<F>a tracked file, all five returnedNone:git grep -e x -- <F> -O'<K> -f kirocrew #'git grep -nO'<K> -f kirocrew #' -e '*;' -- <F>git -c core.pager='<K> -f kirocrew' grep -e '*;' -- <F>GIT_PAGER='<K> -f kirocrew' git grep -e '*;' -- <F>a=('-O<K> -f kirocrew #'); git grep "${a[@]}" -e '*;' -- <F>Real git 2.50.1 in a scratch repo, with a pager that only writes a marker file, confirms the
-nOand array forms run the pager with no terminal;-c core.pagerandGIT_PAGERare the pager git uses when it paginates. Form 1 (-Oafter--) is read as a pathspec by git 2.50.1 and runs nothing there, but-Oafter a pathspec with no--is parsed as an option and does run; the floor refuses the-Opager spelling regardless, since it cannot know which git is installed.What changed (motivation → approach → change)
_is_self_killabout it._git_grep_pager_commands(new,argv_floor_self.py) rebuilds each frame's commands from that frame's text as submitted. It decodes$'…'with_decode_shell_quoted_literalsand takes commands and words from the shared readershell_commands.read_commands, which walks_iter_shell_charsand cuts only at unquoted separators, so quoting is read in one place and a quoted;or|inside an argument (-e 'x|y') does not cut onegit grepin two. A wrapping shell's name is matched in any case (BASH -c) for this read only, through_shell_payload_walk(..., fold_shell_names=True); every other caller keeps the case-exact match. For eachgit grepcommand it reads only the positions git parses as options for that invocation:gitfound after any wrapper andVAR=xwords, with the existingargv_rules._program_argsstep-over (sudo,env,timeout 5, …); aGIT_PAGER=/PAGER=word anywhere beforegit;-c core.pager=/-c pager.grep=option betweengitandgrep(key case-folded, as git folds config keys); every git global option that takes the next word as its value (-C,-c,--git-dir,--work-tree,--namespace,--super-prefix,--config-env,--attr-source) skips that word, sogit -C . grep -O…andgit -c user.name=x grep -O…reachgrep; a bare--exec-path,--version/-vor--help/-hends the read, since git then prints or runsversion/helpand never runs grep;-O<cmd>/--open-files-in-pager=<cmd>(git's rule, so-O<kill> -Ocatrunscat), including each element of a literal array expanded there."${a[*]}"is one word,"${a[@]}"one per element, unquoted forms split, and an expanded element never takes the real word after it as its value;-P/--no-pager, or a git-boolean-false-c pager.grep(false,no,off,0, empty; the last one wins), turns them off. An explicit-O<cmd>still runs either way, as in git.A short cluster is walked one letter at a time, as git's parse-options walks it:
Ois the pager only before the first letter that takes a value (e,f,m,A,B,C), because the rest of the cluster is that value. So-nO<cmd>and-FO<cmd>run a pager, and-eO<cmd>/-C3O<cmd>do not. A separate value word is skipped too (-e <pattern>,-f <file>,--regexp,--context, … and unique prefixes of them), so a kill-shaped pattern is never read as a pager._is_self_killis called on each pager command; a pager string is a substring of one word, so strictly shorter and the recursion ends.-F/-Eare flags;-f/-etake a value), and the floor otherwise reads lower-cased text, which hid-FO<cmd>.deny_gatenow hands_is_self_killthe command as submitted (raw_text=), the same way it already does for_is_credential_mint, and only the pager read uses it. Every other kill shape in_is_self_killstill readstext_lower, and a pager command is recursed on ascommand.lower(), so no other verdict depends on case. Checked by running 22 non-git grepkill shapes (PKILL -f kirocrew,Kill $PPID,KILL -9 $(pgrep …),Kill $(pidof KIROCREW),BASH -c '…',sudo PKILL …,echo PKILL …,kill 1234,echo 'a|b'; PKILL …,pkill -f 'kiro|crew',ls | grep -e 'x|y'; pkill …,kill -0 $$, …) throughis_deniedat origin/main and at this head: the outputs are byte-identical (15 refused, 7 allowed on both;Kill $PPIDis allowed on both). The program name and the-ckey are folded;GIT_PAGER/PAGERmatch as written, since POSIX environment names are case-sensitive. Thesecurity.mdsentence that named mint as the only raw-text predicate is updated.--open-files-in-pageris matched by a prefix only when that prefix is unique among grep's long options:--op=<cmd>runs the pager, but--o=<cmd>is ambiguous with--or, git refuses it, and the floor allows it as on origin/main._ARRAY_EXPAND_REis reused; everything else is argv walking._grep_arg_pager(no clock):work(2000) <= 6 * work(500)andwork(500) <= 2 * len(cmd). A planted per-word rescan fails it (ratio 15.8; the real code reads 4.0)._array_assignments(unchanged from origin/main, so other floors keep their verdicts): the last assignment wins,a+=(…)appends,a[N]=…sets one index,a=xon an array sets element 0, and$a/${a[0]}/${a[N]}read one element.src/kiro_crew/security/argv_floor_pager.py(1,016 lines), first inargv_floor._OWNERS;argv_floor_self.pyimports only_git_grep_pager_commandsfrom it and is 1,254 lines (1,235 on main).Wider alternative, and why it lost: make every pager value a nested payload in
shell_normalizer._nested_shell_payloads, so every floor (mint, publish, kill) sees it, failing closed on any value the floor cannot resolve. That would also covergit logand unknown variables, but it changes what every floor sees, refuses ordinarygit grep "$pattern"lines that open no pager, and AGENTS.md puts narrowing at the deciding site, not in the reader. This PR changes only the kill decision, forgit grep, parsed as git parses it.Rule for what is read: anything visible in the same simple command as the
gitcall is read; anything set by an earlier statement is a known limitation, except plain scalar and array assignments earlier in the same text, which the issue's form 5 needs. So the floor readsGIT_PAGER=/PAGER=,GIT_CONFIG_COUNT/GIT_CONFIG_KEY_<n>/GIT_CONFIG_VALUE_<n>andGIT_CONFIG_PARAMETERSassignment words beforegit;-c core.pager=/-c pager.grep=(the last of each wins);--config-env=<key>=<var>when<var>is assigned beforegiton the same command; an inline-c alias.<name>chain that ends atgrep; agit greprun byfind -exec; and each command of a here-document fed to a shell that reads its script from standard input (bash <<EOF,bash -s <<EOF,bash -o pipefail <<EOF), at any depth. Array assignments earlier in the same text are the one exception the issue itself names (form 5), so they are read too (see Arrays above).Review history: four blind adversarial review rounds (artifact and contract only) ran on earlier heads, and each returned BLOCK; what each found and fixed is in that head's Sensitive Change comment. Round 5 (this head) had no blind review: the four rounds are used, so its fixes are checked only by direct
is_deniedprobes against origin/main and by CI. Round 5 fixed:GIT_CONFIG_COUNT, aGIT_CONFIG_KEY_<n>name or a subscript (assigned, read or compound) is never converted, sois_deniedcannot raise; on the pager path the command is refused;gitin this text" shortcut looks at the text with quotes, backslashes, line continuations and empty substitutions removed, sog''it,"g"itandgi\tare read;p='-O<kill>'; git grep "$p",-O"$p");&&/||, in a pipeline or with&keeps the earlier value as a candidate, and eachgit grepis read under every combination (at most 8 candidates per variable and 16 combinations, else refused);GIT_CONFIG_COUNTis read as git reads it (+1, leading zeros,k/m/g), and the numbered pairs come beforeGIT_CONFIG_PARAMETERS, which wins;GIT_PAGER, apager.grepcommand,core.pager,PAGER), soGIT_PAGER=cat git -c core.pager=<kill> grep -Ois allowed;-p/--paginate/-P/--no-pagerresolves to grep;git grep(MAX_SCANNABLE_COMMAND_CHARS), with 16 times that for a whole text, so the honest 3,194-char growing-array script passes.Round 7 (head 1d20dfc): Security Scope Review on 9019655 confirmed three over-cap flag-toggling searches main allows (
--only-matching,--or,-e 'core.pager=') that this PR refused. Past the caps, a grep word of plain characters now counts only when it is an-Ocluster or a long option whose name (over 2 characters) is a prefix of--open-files-in-pager; any other word and every candidate value keep the wide test. Three blind review rounds; round 3 found no new allow and one false refusal (a bare--), fixed by the length guard. Allow and deny rows for these shapes are in the test file.Round 8 (head 7721537): Security Scope Review on a5f6d2b confirmed one more over-cap false refusal main allows: five optional empty flags past the 16-combination cap, then a single-quoted regex (
git grep $i $n $w $l $c -E 'core\.pager\s*=' -- src/kiro_crew). Past the caps, a grep word bash passes exactly as written (each character plain or quoted literally,_is_literal) now gets only the pager-option test, as a plain word already did; a killing-O, quoted or not, is still refused. Allow and deny rows are in the test file. One blind review round, CLEAN.Round 6: the candidate caps count only values that could carry a pager, so the two scripts Security Scope Review found newly refused on round 5 are allowed again, and so is a variable past the cap that the
git grepnever reads (Opus, first round-6 push). Allow tests for both and deny tests for over-cap killing-Oshapes are in the same commit. Rebased onto main ab16fd6 (#22646's refusal span), with the kill floor's span taking the command as submitted. No blind review for rounds 5 and 6.Open, for a maintainer to rule (with severities):
-Oinside an expansion after a literal-Ocat(a=(-O); git -c core.pager='<kill>' grep -Ocat "${a[@]}") is read ascat, but git runs the configured pager. origin/main allows it too.pager.grep=2(and-1,+1,01) is read as a program, but git reads it as true and runscore.pager. origin/main allows it too.p=-Opk; false && p=-Ocat; p+='ill …') updates only the current value, so the killing result is never read. origin/main allows it too.bash -/sh -with a here-document is read as a script file, so the here-document body is not read. origin/main allows it too. Opus 5.5 flagged the same gap again on 205e859 (argv_floor_pager.py:355, a lone-read as a script file).busybox sh <<EOF(and other busybox shell applets) is skipped outright (argv_floor_pager.py:432,program != "busybox"), so the here-document body is not read, though busybox sh runs it from standard input. origin/main allows it too.(a=(-Ocat)),(p=-Ocat)), a command substitution (x=$(a=(-Ocat))), or a pipeline / background compound (a=(-Ocat) & wait) replaces the parent's value, soa=('-O<kill>'); (a=(-Ocat)); git grep "${a[@]}" -e xis allowed. A quoted or escaped assignment name ('a=-Ocat', which bash runs as a command) is read the same way. Bash keeps the parent's killing pager. origin/main allows it too.bash -eo pipefail <<EOFreadspipefailas a script file (_shell_reads_stdinsteps one word past a cluster ending ino), so the here-document body is not read; same as the lone-entry above. origin/main allows it too.a=-e; git grep $a -e '-O<kill>'is read with-O<kill>as the pattern, but git runs it as the pager.set -kalso moves assignment-shaped grep words (GIT_PAGER=…) into git's environment, which the floor does not read. origin/main allows both.git grepcarrying a literal non-killing-O(-Ovim,-Ocat; GPT 6.1 too), or a quoted pattern with a space that names a pager setting or a--o…word (-e 'core.pager = less',-e 'kirocrew --open'). main allows these.$(…)before the-Oword cuts the command sogitis not found (git grep -e x $(true) -O'<kill>'); git appends matching paths to the pager, so-O'pkill -f' … -- kirocrewwith a file namedkirocrewruns a kill the pager text alone does not name;${a[-1]}and${p:-}are dropped as references. origin/main allows all three.a=; git grep -e $a '-O<kill>'reads the pager as-e's value; an unconditional write after a conditional one keeps an obsolete killing candidate. origin/main allows both.a=(newline-i '-O<kill> -f kirocrew #'newline), thengit grep "${a[@]}" -e x -- src) is read as an empty array, because the shared reader cuts at the newline aftera=((argv_floor_pager.py:527), so the pager inside it is never checked. origin/main allows it too.p=-Ocatafterfalse && p=…) does not clear the earlier candidates, so a killing earlier value still refuses.a=(-e); git -P grep "${a[@]}" '-O<kill>'is refused although git reads that word as a pattern. A killing pager inside an array, or a configured one, is still refused when a later-Ocator a--no-open-files-in-pagerinside or after the expansion overrides it (GPT 6.1 again on 2f69b67, downgraded to LOW: an inserted-Ois distrusted on purpose, because the array the floor read may not be the one bash expands).GIT_CONFIG_*/--config-env,find -execand here-docs, conditional candidate sets and octal/hex subscripts) are outside the Goal's five spellings; it clears when those are removed or a human amends the Goal. Design suggests treating-O,core.pager=,pager.<cmd>=andGIT_PAGER=values as payload carriers in the existing_nested_shell_payloadswalk, which would cover every paging subcommand. First Principles suggests dropping the here-doc,find -exec, alias,GIT_CONFIG_*,--config-envand conditional-world reads.declare -a/local/readarrayassignments, negative and arithmetic subscripts (${a[-1]},${a[i]}), slices (${a[@]:1}), and a copy through an expansion (b=("${a[@]}")).export GIT_PAGER=…/export PAGER=…/declare -x/export GIT_CONFIG_*in an earlier command are not read; the value reaches git's environment outside thegitcommand.gitat the bottom grows about 4x per doubling (1.86 s at 13.4 KB throughis_denied, origin/main 0.44 s; 0.25 / 0.67 / 2.0 s at 3.2 / 6.6 / 13.4 KB in this PR's own measure). Commands over 20,480 characters are refused before any scan, which bounds this. A linear read would need a new mode in the sharedshell_commands.read_commands, which this PR does not add.a=(-c core.pager='<kill>'); git "${a[@]}" grep -O x,cmd=(git grep -O'<kill>'); "${cmd[@]}" x.git config core.pager '<kill>'run as an earlier command;--config-env=core.pager=XwhenXis not assigned on the same command; aliases from config files; non-shell wrappers in upper case (SUDO,ENV) beforegit.-O<kill>after--; an array-Ofollowed by a real-Ocat;--html-path/--man-path/--info-pathmissing from the exit options;unset anot tracked.GIT_CONFIG_PARAMETERS, alias words) is split withshlex, which differs from git'ssq_dequote/split_cmdlineat the edges; no bypass was found.Blind review rounds for each head are listed in that head's Sensitive Change comment.
Backwards compatibility
Compatible: a command is refused only when a
git greppager or pager setting in it runs a by-name kill of the product. Every other command gets the same verdict as on origin/main. Conditional values are kept once per distinct value. Past 8 of a variable thegit grepreads, or 16 combinations, the floor refuses only when a candidate or a word of thatgit grepcould carry a pager; inert candidates (rc=1after each failed check, optional flags) are dropped and the current value is read, and a variable thegit grepdoes not read never counts. The probe in Manual verification checks the allowed shapes, including a plaingit grep, an-epattern shaped like a pager (separate and glued,-eO…),-C3O…, a lower-casegit_pager=, and anechoof a pager spelling after agit grep.Removes nothing: no key, path, record or public function is removed. The shared
_array_assignmentsand its caller are as on origin/main.Tests
test/test_argv_floor_git_grep_pager.py(new, ours — this PR does not touch #34097's file):test_the_five_named_pager_forms_are_refused: the five Self-kill argv floor does not refuse five git grep pager forms #34098 forms.test_adjacent_pager_spellings_are_refused:--open-files-in-pager=,--open=abbreviation,-c pager.grep=,PAGER=, an array with a leading decoy element,-Oclustered after-F/-nE/ a number (-3O), an upper-caseGIT, a mixed-case-c Core.Pager=,sudo git grep -nO…,env GIT_PAGER=… git grep, and-Oafter a plain pathspec with no--.test_a_git_grep_without_a_killing_pager_is_allowed: a plaingit grep(also undersudo),-o/--only-matching/context flags,GIT_PAGER=less,git -c core.pager=<kill> log, the kill text as an-epattern (separate, in an array, and glued as-eO…),-nC3O…,--reg '-O…', a lower-casegit_pager=, the kill text in a separateechocommand or echoed asGIT_PAGER=…, andgit log --grep.test_a_long_pager_option_list_is_checked_in_linear_time.test_a_quoted_separator_before_the_pager_does_not_hide_it: a quoted;and a quoted|before the pager, in forms 1, 2 and 5 (six cases). The allowed list addsgit grep -e 'x|y' -n -- f,-e 'x;y'and the ambiguous--o='<kill>'.test_a_capitalised_kill_is_still_refused,test_a_capitalised_command_that_kills_nothing_of_ours_is_still_allowedandtest_the_submitted_case_changes_no_verdict_outside_a_git_grep: the raw-text hand-off changes no verdict outside agit grep(_is_self_kill(lower, raw_text=cmd) == _is_self_kill(lower)).test_adjacent_pager_spellings_are_refusedalso covers a value-taking global option before grep:git -C .,git -c user.name=x,git --git-dir .git, and-c Pager.Grep=<kill>/ a laterpager.grep=trueturningcore.pagerback on.test_quoting_wrappers_and_array_boundaries_do_not_hide_the_pager:$'…'pager words,BASH -c/Sh -c, and array boundaries ("${a[*]}"before a real-O).test_a_git_grep_without_a_killing_pager_is_allowedaddsgit -P/--no-pagerwith a killingcore.pager, last-Owins (-O<kill> -Ocat), and-c pager.grep=false/Offwith a killingcore.pagerorGIT_PAGER.test_the_shell_name_fold_reaches_only_the_self_kill_floor: with the pager read's shell-name fold switched off, no verdict on a non-kill command changes.test_a_pager_the_same_command_shows_is_refusedandtest_a_pager_the_same_command_overrides_or_never_runs_is_allowed: one deny and one allow case for each of the here-document,--no-open-files-in-pager, lastpager.grep/core.pager,GIT_CONFIG_*,--config-envand inline alias reads.test_an_array_pager_is_read_as_bash_assigns_itandtest_an_array_element_bash_does_not_pass_is_not_read: one deny and one allow case each for a later re-assignment,+=,a[N]=,"$a","${a[0]}"and"${a[N]}".test_repeated_array_references_are_read_once: work counted up to 36 KB for a long element and for many short ones; 4x the command costs at most 6x the work (measured 4.0x; the previous head measured 16x).Proof: not provable -- other: the host forbids local test runs, so the prepare-pr prove.py cannot run here. Behaviour was checked by calling
security.is_denieddirectly at both commits (see Manual verification).Once this and #34097 both merge, #34097's strict-
xfailtests for these five forms should flip to pass; this PR's own tests are the forward-looking pins in the meantime.Manual verification
I called
security.is_denieddirectly from a script (this does not run the test suite), with the worktree'ssrconPYTHONPATH:git -C .,git -c user.name=x,git --git-dir .git,git --no-pager -C ., and a second-cafter a non-pager one) — the five named forms plus the adjacent spellings above (-FO,-nEO,-3O,GIT,Core.Pager,sudo,env GIT_PAGER=,timeout 5,cd … &&) — all refused withrule=self-protection-kill.git grep(also undersudoandgit -C .), a kill spelling as the value of-Cor-c user.name=,-no/-C 3/-Ovim,GIT_PAGER=less, lower-casegit_pager=,git -c core.pager=<kill> log, the-e-pattern cases (separate and glued-eO…),-nC3O…,--reg '-O…', the twoechocases,git log --grep— all allowed, each matching origin/main's verdict.sudowords 0.13 s; 3000-C .pairs 0.17 s; an 800-deep nestedgit grep -O…pager 0.18 s.;or|(single, double or backslash-escaped) before the pager in forms 1, 2 and 5, insidebash -c "…", after an earlierecho hi;, and in$( … )— all refused. 14 more allowed shapes —git grep -e 'x|y' -n,-e 'x;y',--o='<kill>', a# git grep -nO…comment, an echoedgit grep -nO…string, and the earlier allowed set — all allowed.-e 'a|b'words before the pager 0.29 s.Blind adversarial review (a fresh reviewer given only the diff and the contract), round 1 on an earlier head: BLOCK with 3 findings. A value-taking git global option before
grep(git -C .,git -c user.name=x) skipped the invocation; fixed and pinned. A wrapper beforegit(sudo,env,nice) skipped it; fixed viaargv_rules._program_argsand pinned. Nestedgit grep -O'git grep -O…'recursion was flagged as possibly quadratic (Optional); measured at 0.18 s for 800 levels, so it is left as is. Round 2 on the next head: BLOCK, one Required and one Optional.git --attr-source x grep -O…skipped the invocation;--attr-sourceand--config-envnow take their value word, pinned. A baregit --exec-path grep -O…was refused though git runs no grep; it now ends the read, pinned as allowed. Round 3: BLOCK, one Critical, one Required, one Optional. The shared splitter strips quotes before it cuts commands, so-e 'x|y'before the pager cut onegit grepin two and hid forms 1, 2 and 5; the pager read now rebuilds the command from the submitted text with quotes in force, and the shared splitting is unchanged (Critical). The tests now put a quoted;/|before the pager (Required).--o=<cmd>was refused though git rejects it as ambiguous; a prefix must now be unique (Optional).Screenshots / video
N/A: no user-visible UI change.
Related Issues
Fixes #34098
Sibling sweep
Swept:
git grep -nE "pager|open-files-in-pager|core\.pager|GIT_PAGER" -- src/kiro_crew/security/Sibling: src/kiro_crew/security/readonly_bash.py -- not affected -- it prompts for pagers on the read-only path; it does not decide self-kill
Sibling: src/kiro_crew/security/argv_floor_self.py -- changed here
Pattern harvest
Rule candidate: review-prompt
Pattern: "a program run from an option or environment value (pager, editor, -exec) hides that program from argv-position checks; read it the way the host tool parses the invocation"
Known limitations
src/kiro_crew/security/shell_normalizer.pyis 1,828 lines on this head against 1,790 on main (+38, this PR's own change); it is not split in this PR.-Ovalue built by joining a variable with a quoted word (x=-O; git grep "$x"'pkill -f kirocrew' x) is not refused. This gap is on main too (probed on 5762722:is_deniedFalse), so this PR does not make it worse.Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.