Repository navigation
fix(security): keep self-host detection when the ssh verb is a glob - #34056
Conversation
Sensitive Change ReviewSensitive files changed: |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Every item either closes the reported Notes
What this change shipsInventory (9 items) — 9 justifiedIntent: stop an agent reaching this host over ssh by naming the ssh program through a glob (
[FIRST-PRINCIPLES-REVIEWED] 01088f1 Description read[DESCRIPTION-READ] 2fe6c7f508f236d29dbdcca904eb6fb70d1958a0f0e8ed86fff5a9451312c59a 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 fix closes a fail-open regression in a floor that no OS fence covers yet (#9806). Each new refusal fails closed, is listed and accepted, and reverts cleanly. Notes
[DESIGN-REVIEWED] 01088f1 Description read[DESCRIPTION-READ] 121abf17ebaeb19eba9ca01551d8e4e6fda23375836508dfa2dd51911685fd18 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed 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 — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
3cca03e to
e72e3c0
Compare
e72e3c0 to
392fdd6
Compare
392fdd6 to
ed268bf
Compare
af76c20 to
73c00a3
Compare
|
Thanks, Bolin. Pushed Part 2, no new Part 1, no new refusals where main passes:
Why Other shapes main allows that stay refused, each because the floor reads it the same way as the attack beside it:
Telling these apart needs the original-case text in the floor and a token walk that splits glued separators and knows comments, heredocs and line joins. That is a change to the floor's walk, so I filed #37438 with these rows, the matching attacks and that direction, rather than widen this PR. Checks on this head: over the 840 rows and 32 hash seeds, compared seed by seed, no row main refuses is allowed; the only non-attack row refused here that main allows under every seed is Could you take another look? |
|
@bolichen97 |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for the narrowed design. One defect in the new case reader blocks merge.
src/kiro_crew/security/argv_rules.py:232:_case_arm_pattern_indicesopens a case state on any word equal tocase, even when that word is only an argument. Trigger:echo case in x; s?h local* id, run in a directory that holds files namedsshandlocalhost. Outcome: theinmoves the state topattern, and every later word counts as a case pattern until a word contains). That includess?h._executed_program_indicesskips it at line 201, so the ssh-to-self floor allows the command. The bares?h local* idis refused on this head, so a trivial prefix undoes the Goal.echo test case in prod; s?h local* idgets through the same way. Main allows these too, so nothing regresses against main, but this reader is new code in this PR. Smallest fix: open a case state only whencaseis the program word of its command (for example, check it against the command starts from_split_commands_indexed). Addecho case in x; s?h local* idas a DENY row intest_a_run_glob_verb_keeps_its_glob_host. The allow rows for real case arms stay as they are.
Optional:
- The new case reader is only tested from the allow side. A DENY row such as
case x in a) :;; esac; s?h local* idwould fail if someone later removedstack.pop()or the arm close transition. - The run-position reader gets lower-cased tokens, but
_WRAPPERSlists uppercase value options. Soenv -C . s?h local*,sudo -D /tmp s?h local*andxargs -P 4 s?h local*are still allowed. This has the same root cause as thesudo -eover-block. You could list them in #37438 with a pinning test rather than fix them here. - The
cd /tmp;s?h local*row passes because of the/in the glued word, not because of the run-position reader.cd tmp;s?h local* idis allowed. A slash-free row, or a narrower claim in the body, would make this clear.
|
@KiroCrewCaptain Thanks. Fixed in 415a52d, with the tests written first.
The 23 related test files give 2,863 passed and 1 skipped. Could you re-review? |
|
Security Scope Review on 415a52d: fixed in 0b0a071, with the tests written first.
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for the fixes. The earlier blocking item is fixed on this head, but one gap of the same kind remains in the new run-position reader.
Earlier request at a59f93e:
echo case in x; s?h local* id: fixed. It is refused on this head, and a DENY row pins it.- Optional, upper-case wrapper options (
env -C,sudo -D,xargs -P): addressed. Reading option words in the case they were written closes them, and DENY rows pin them. - Optional, the
cd /tmp;s?h local*row: answered in your comment. The body still says this row is closed without naming the/(see the notes below).
Still blocking:
security/argv_rules.py:204(_executed_program_indices). The first word of a case-arm body is never marked as run. Trigger: with files namedsshandlocalhostin the working directory, runcase x in x) s?h -F /dev/null local* id;; esac. Outcome:_split_commands_indexedgives one command that starts withcase, so_program_indexmarks onlycase.s?hkeeps the glob-verb exemption,local*is never matched as this host, andis_deniedreturns None. Bash then runsssh -F /dev/null localhost id. The same happens withcase x in x) env s?h local* id;; esac,case x in (x) s?h local* id ;; esacandcase x in a) :;; x) s?h local* id;; esac. The bares?h -F /dev/null local* idis refused on this head, so a one-wordcasewrapper defeats the Goal. Main allows these too, so this is not a regression. But the reader is new in this PR,_case_arm_pattern_indicesalready setsprogram_position = Trueright after the arm's), and the test comment neartest/test_denied_commands_security_ssh_self.py:827says arm-body commands are covered. Its only row is the form after;. Smallest fix: have_case_arm_pattern_indicesalso return the index of each arm body's first word, and in_executed_program_indicesrun_program_indexfrom that index so wrappers such asenv s?hresolve too. Then add DENY rows for the four spellings above. If you would rather defer it to #37438, add a known-gap row that pins the current allow, narrow the test comment and the security.md sentence to match the code, and ask a maintainer to record the decision on this head.
Optional:
- A
;glued inside a word (cd tmp;s?h local* id) is still allowed, andcd docs;ls s* *.*is newly refused. Both come from one cause:_gate_wordscuts the word at the;, but the run-position reader does not. The body discloses both. The Security Scope block on this head still has no recorded decision. sudo -T 5 s?h local* idis still allowed because-Tis missing from the sudo value options in_WRAPPERS.- The "What changed" table row
cd /tmp;s?h local*reads as closed only because of the/. Naming that, and listing the case-arm body as open until item 1 lands, would make the body match the code.
|
@KiroCrewCaptain Thanks. The case-arm body is fixed in 61b1a7e, using your smallest fix, with the tests written first.
The 23 related test files give 2,878 passed and 1 skipped. On the 840-row measure, 0 rows are newly allowed against main, and the 46 newly refused rows are all attacks. Could you re-review? |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for the case-arm fix. One gap of the same kind is left, in the verb gate this PR adds.
This is the third review round on one class (a glob verb the run-position reader does not see), after case in x and the case-arm body. AGENTS.md asks that a finding which repeats a class change the approach rather than patch another spelling, so please pick one of the two routes in item 1 that closes the class (gate the unmasked text), or defer it with a known-gap row. Another one-spelling patch is not what this asks for.
Earlier request at 0b0a071:
- First word of a case-arm body not marked as run: fixed. On this head,
case x in x) s?h -F /dev/null local* id;; esac,case x in x) env s?h local* id;; esac,case x in (x) s?h local* id ;; esacandcase x in a) :;; x) s?h local* id;; esacare all refused, and DENY rows pin them. - Optional, the glued
;shapes (cd tmp;s?h local* id,cd docs;ls s* *.*): answered. They are tracked in #37438 and #37543. - Optional, the
cd /tmp;s?h local*table row: answered in the body.
Still blocking:
src/kiro_crew/security/argv_floor_ssh.py:127(_GATE_WORD_SEPARATORS), which returns early at:1174. A glob verb at the start of a double-quoted$( )never passes the verb gate. Trigger: with a file namedsshin the working directory (andlocalhostfor the glob-host forms), runecho "$(s?h localhost id)",echo "$(s?h local* id)"orx="$(s?h local* id)". Outcome:_mask_quoted_separatorsturns the quoted(into its mask sentinel, so the probe word is$\x05s?h._gate_wordsdoes not cut at that sentinel, so_glob_can_name_ssh_verbreturns False. The function then returns at:1174before the double-quoted body reader at:1183runs. That reader would refuse the body, because_is_ssh_to_self('s?h localhost id')is True. All three lines are allowed on this head, even with a literallocalhost. The unquotedecho $(s?h local* id)is refused. Main allows these lines too, so this is not a regression. But the new docstring says a verb glued to a substitution opener ($(s?h) is still a word, and the Goal says a glob such ass?hcan no longer reach this machine. Neither #37009 nor #37438 names this form. Smallest fix: add the mask sentinels the floor emits to_GATE_WORD_SEPARATORS, or also run the gate over the unmasked text. Then add DENY rows for the three lines above totest_a_run_glob_verb_keeps_its_glob_host, plus an ALLOW row such asecho "$(ls s* *.*)". If you would rather defer it, name it in the body's Backwards compatibility gaps and in #37438, and pin the current allow with a known-gap row.
Optional:
- In a recursive frame, wrapper options are read lower-cased. So
echo "$(sudo -H ls s* l*)"is newly refused (main allows it), andecho "$(sudo -H s?h local* id)"stays allowed. TheBreaking:list does not name the first. #37543 also says a double-quoted$( )is not affected, which is not what happens on this head. Passing the written-case body into the recursion at:1183would fix both. argv_floor_ssh.pygrows from 1,537 to 1,631 lines, past the 1,600-line target. You could move_gate_wordsand_glob_can_name_ssh_verbinto a sibling module.- The only row that pins the glued
;/|operand guard (git add *; curl -s localhost:3000/healthz) goes red only on some hash seeds. A row whose glob names exactly one verb, such asgit add s?h; curl -s localhost:3000/healthz, would red on every run.
|
Thanks. All three items from your review on aaefd76 are in head 0a36723, which is also rebased onto current main (it keeps the nesting bound from #37820 and its tests):
The 840-row measure still shows no row that main refuses allowed here. Could you re-review? |
|
Re-review of e111e14. Nothing from my review on aaefd76 still stands:
I found no blocking defect. The review ran is_denied on this head and on main over the ssh-self test rows under several hash seeds, and no command that main refuses is allowed here. When the new guards were mutated one line at a time, most of the mutations turned a named test row red. The fix is tied to where bash actually runs the word, and when the reader cannot tell, it falls back to main's reading. It cannot be approved yet because PR Readiness is red on this head. These items are still open:
Optional:
|
|
/ai-review override gpt e111e14 deferred #37543: A false refusal that fails closed, deferred to #37543. A nested read (a bash -c payload, a function body, a double-quoted $( ) or rsync's remote shell) still reads wrapper options lower-cased, so sudo -H is read as -h and the next word is skipped. It needs a nested script, an upper-case wrapper option, a glob that could spell an ssh verb as an operand and a self-host word, all together; the call goes to an approval and nothing reaches this host. |
Sensitive change review
|
Human judgment recorded@buluoray recorded a deferred release (class
This decision applies only to this commit. A new push requires a new judgment. |
|
@buluoray the Captain's re-review on
Optional from the same review: deny rows for the bracket-class branch in AI-assisted, sent by Bolin Review bot |
A verb read through a bare glob such as s?h turned glob host matching off, so s?h -F /dev/null local* id was allowed. In a directory holding files named ssh and localhost, which an agent can create, the shell expands it into an ssh connection to this host outside the sandbox. Keep glob host matching on when bash runs the glob verb: in program position, or as the program a command wrapper runs (resolved by argv_rules._program_index). A glob verb that only sits in another program's operands keeps main's reading, so tar, git add and find lines over globs stay allowed. The verb gate splits words at command separators and parentheses, so a glob verb inside a subshell, a command substitution or after a glued ";" is read too, and an assignment that opens a $( hands the program position to the substitution's own program. The gate also cuts words at the sentinels that stand for a quoted separator, so echo "$(s?h localhost id)" is read like its unquoted form. The gate words, the glob test, the ssh-family verb set and the quoted-separator sentinels live in a new owner module, argv_floor_ssh_gate, which keeps argv_floor_ssh under the line cap. The ssh gate is one more owner module on every MCP server listing path, so each server ceiling in test_mcp_listing_import_budget.py rises by 1.
|
Owner decision for #34056 (head
Gaps that main shares stay open and are tracked in #37009 (runner-started globs, seed-dependent multi-name globs, the copy path, |
|
/ai-review override scope 01088f1 owner-decision: main allows, PR refuses, fail closed, each read the same as an ssh-to-self attack (rows in Decision, tracked in #37438 and #37543): backtick assign x= |
Sensitive change review
|
Human judgment recorded@buluoray recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving head 01088f1. The review ran is_denied on this head and on the merge base over more than 120 hand-written rows. It also ran main's ssh-self test file against this head's code: the only change is the intended flip of s?h local*. When run against main's code, this head's ssh-self test file fails all 30 rows of test_a_run_glob_verb_keeps_its_glob_host, which shows the tests pin the fix. The ssh-self and cost test files pass at this head (604 tests). PR Readiness is green, and every lane on this head passes.
Security: this changes the ssh-to-self deny floor, so the risk is a command that main refuses being allowed here. The review found no such command. Every glob-verb attack shape it tried that this head refuses, main allows. Main allows the shapes this head still lets through, so none of them is a regression. The new refusals all fail closed to an approval, and the description lists them.
Earlier review items: the echo case in x opener, the case-arm body first word and the glob verb inside a quoted $( ) are all fixed, and deny rows pin each one.
Done well: the exemption now follows where bash actually runs a word, through the existing wrapper resolver, rather than another spelling in a matcher.
Optional:
_case_arm_pattern_indices(argv_rules.py:257) closes a case only on a bareesac. In{ case x in x) :;; esac;}; s?h local* id, the case never closes, sos?his read as a pattern and the line is allowed. Main allows it too. A prefix match onesacplus a deny row would close this.- The glued-separator forms (
cd tmp;s?h local* id,echo a;s?h local* id) and the nestedsudo -H/env -Cforms are still allowed, as on main. Known-gap rows citing #37438 and #37543 would make the follow-up flip a test. The comment above thecd /tmp;s?h local*row could say that row is refused because of the/. - No test covers the bracket-class read in
_glob_can_name_ssh_verb(argv_floor_ssh_gate.py:106) or the open-backtick check (argv_rules.py:303). Deny rows for(s[s\)]h local* id)andx=`true` s?h local* idwould pin them.
Problem / Motivation
Goal: An agent can no longer reach this machine over ssh, outside the sandbox, by naming the ssh program through a glob such as
s?h.The ssh-to-self floor (
sandbox-escape-ssh-self) stopped reading a glob destination as this host whenever the verb itself was a bare glob. The GPT review lane found this on #33675 (comment 6732935991, head 79cad72), and the Opus lane upheld it:An agent can create both files itself, so this needs no help from the user.
Why it matters
The ssh-to-self floor is what keeps an agent from re-entering the host outside its sandbox mounts. With this hole, any agent turn that can write two files in its working directory can run a command on this machine with none of the governance mounts applied. The bug is on main and on
release/0.12.0(the pick f24c5dc from #34021 carries it), so 0.12.x users get it.Not a goal
*that bash runs as the program can name ssh (touch ssh && * lvh.me id), so it is refused likes*; a five-field cron schedule that starts with a digit (0 * * * *) keeps passing, and one that starts with*goes to approval.release/0.12.0once this lands.What changed (motivation → approach → change)
Root cause. #33299 added
glob_verbinsrc/kiro_crew/security/argv_floor_ssh.py(_is_ssh_to_self) so cron schedules quoted in MCP arguments stop reading asssh localhost. It setglob_verbfor any bare glob verb and passedmatch_globs=not glob_verbto both operand checks. Sos?h local*turned the self-host check off. But a glob is only an ssh invocation when the shell runs it; a glob that sits in another program's operands is a file name.Fix: read the glob verb by where bash runs it.
argv_rules._executed_program_indicesmarks the word bash runs in each command: the program, or the program a command wrapper runs (env,sudo,time,nice,timeout,nohup,command,xargs, through the existing_program_index, split out of_program_argswith no change in behaviour).glob_verbnow also needs the glob to be outside those positions, so a glob verb that bash runs keeps glob host matching, and every other glob keeps main's reading. Three smaller parts make the run position visible: the verb gate splits words at;,|,&, parentheses and backticks with one plain character walk (_gate_words), so a glob verb in a subshell, a command substitution or after a glued;is seen; an assignment that opens a$(, a backtick or an array literal (files=$(ls s* l*),n=`ls s* *.*`,files=( s* *.* )) hands the program position to the substitution's own program, or to none; and acasearm's pattern list (s* | r* )) is never a run position.s?h -F /dev/null local* id,env/sudo/time/nice/timeout/xargs s?h local*,s[s]h local* id(s?h local* id),echo $(s?h local* id),x=$(s?h local* id),cd /tmp;s?h local*(because of the/;cd tmp;s?h local* idis still allowed, #37438)tar … s* *.*,find s* l*,mypy src/*,pytest test/*,files=$(ls s* l*),watch -n 5 ls -la logs/*0 * * * */* * * * *cron lines,* lvh.me id,s* example.com idNothing else in the floor changes: no program list, no runner list, no heredoc or array reader, and multi-program globs keep main's (hash-seed-dependent) reading. An earlier, wider version of this PR is kept at
23a3ff4663d676cbbe8ef520509c8e47470b8c52(branch tip before this change, recoverable withgit fetch origin 23a3ff4663d676cbbe8ef520509c8e47470b8c52).Backwards compatibility
Breaking: src/kiro_crew/security/argv_rules.py:_executed_program_indices -- chat, cron -- besides the fix itself (
s?h local*and its wrapper, subshell and substitution forms, now refused), a few rare commands that main allows are refused, because the floor reads their glob the same way as an attack it must refuse. Each fails closed (a loud refusal that goes to an approval, never an allowed ssh to this host) and is recoverable by naming the files or writing the line another way:x=`s* l*`;command -v s?h local*; a heredoc body line that starts with a glob pair (cat <<'EOF'withr* l*); a trailing comment that holds a spaced;before a glob pair (ls # x ; s* l*); a^line join before a glob line; and a;or|glued tols s* l*. All of them, with the attack each is read the same as, are tracked in #37438. A wrapper option inside a nested reading is still read lower-cased, soecho "$(sudo -H ls s* l*)"and the samesudo -Hline insidebash -c '…'or a function body are refused; that is tracked in #37543. Gaps that main shares stay open and are tracked in #37009: a*or multi-program glob that a runner starts (strace * id,strace -k s?h …), multi-program globs (s*,*s*) whose reading depends on the hash seed, a glob copied bycp/mv/ln/installand then run, and a quoted>in a one-program-o proxycommand=value.Reader: src/kiro_crew/security/argv_floor_ssh.py:_is_ssh_to_self -- cron -- an unattended MCP call quoting a schedule keeps main's answer: test_denied_commands_security_ssh_self.py::TestSandboxEscapeSshSelf::test_an_unattended_mcp_call_quoting_a_cron_schedule_is_approved
Reader: src/kiro_crew/security/argv_floor_ssh.py:_is_ssh_to_self -- chat -- a glob in a program's operands still passes: test_denied_commands_security_ssh_self.py::TestSandboxEscapeSshSelf::test_a_glob_host_after_a_glob_verb_is_not_this_host
Reader: src/kiro_crew/security/argv_rules.py:_program_args -- chat -- unchanged: now calls the extracted
_program_index: test_argv_rules.pyTests
test/test_denied_commands_security_ssh_self.py:test_a_run_glob_verb_keeps_its_glob_host(DENY, new):s?h -F /dev/null local* id,s?h local*,s?h local* id,s[s]h local* id,env/sudo/time/xargs s?h local*,echo $(s?h local* id),x=$(s?h local* id),x=$(true) s?h local* id,(s?h local* id),cd /tmp;s?h local*(refused because of the/;cd tmp;s?h local* idis allowed here and on main, ssh-to-self floor: read sudo -e, comments, heredocs and glued separators the way bash runs them #37438),echo case in x; s?h local* id,echo test case in prod; s?h local* id,case x in a) :;; esac; s?h local* id,case x in a) true; s?h local* id;; esac,echo "$(s?h localhost id)",echo "$(s?h local* id)",x="$(s?h local* id)"(a glob verb right after a quoted$(: the gate now also cuts words at the floor's quoted-separator markers). 13 of its rows were red on main. Acaseopens a case statement only in command position, and the first word of each arm body is read as that arm's program:case x in x) s?h -F /dev/null local* id;; esac,case x in x) env s?h local* id;; esac,case x in (x) s?h local* id ;; esacandcase x in a) :;; x) s?h local* id;; esacare deny rows, andcase "$f" in docs) ls s* *.* ;; esacis an allow row.test_a_glob_host_after_a_glob_verb_is_not_this_host(ALLOW):s?h local*moved out of it; operand globs after other programs and the four$(assignments (files=$(ls s* l*),hashes=$(sha256sum s* *.*),n=$(ls s* *.* | wc -l),count=$(ls r* *.* 2>/dev/null | wc -l)), red before the assignment fix;echo "$(ls s* *.*)"is a new allow row. The glued-;guard row isgit add sc?; curl -s localhost:3000/healthz, which goes red on every hash seed with the guard removed.sudo -H ls -l s* *.*,sudo -H du -sh s* l*,sudo -E ls s* *.*,sudo -e s*andcd /etc/ssh && sudo -e s* *.*are allow rows (sudo -eedits files and runs no program).env -C . s?h local*,sudo -D /tmp s?h local*,xargs -P 4 s?h local*,sudo -H s?h local* idandsudo -E s?h local* idare deny rows.test_an_upper_case_program_or_verb_is_still_readkeeps upper-case program and verb names refused. The backtick assignment, array literal and|-splitcasearm rows are allow rows, red before their fix.test/test_denied_commands_security_cost.py::TestSshGateBracketWordsAreLinear(new): runs_gate_wordson long runs of[and asserts, with no timing, that it visits each character at most twice and that its words never add up to more than the input (red on a re-appending variant); a second test keepss[s)]h,s[sx]h,[rs]s*ands[s]hone word each. A slowerfnmatchpath on the same input is on main too and is tracked in ssh-to-self floor time grows quadratically on a long run of [ (fnmatch) #37373.test/security_line_budget/ssh-self-glob-verb.txt: a+302row for this change's own net lines undersrc/kiro_crew/security/, sotest_security_gate_liveness.py's package budget holds.test/test_mcp_listing_import_budget.py: each MCP server's module ceiling rises by 1, because the new ssh gate owner loads on every listing path.src/kiro_crew/security/argv_floor_ssh_gate.py(new):_gate_words,_glob_can_name_ssh_verb,_cannot_name_ssh_verb(from fix(security): keep a quote in a $( ) from hiding a later ssh #37558) and the constants they read move here, soargv_floor_ssh.pystays under 1,600 lines; the facade lists it in_OWNERSandsecurity.mdnames it._cannot_name_ssh_verbalso probes the text with every quoted-separator key blanked, so it agrees with the gate's sentinel cut. The case-kept text goes through the same_mask_quoted_separators(..., blank_bodies=True)as the lowered text, and the per-call cache key includes it. New tests pin all three.The rows in the glob tests pass under
PYTHONHASHSEED0 to 31. Against main under 32 hash seeds, with the resolver stubbed to fail closed and no network, over 840 rows (631 ssh-to-self test rows, 181 of them again with each loopback spelling replaced bylvh.me, and 28 ordinary lines): no row that main refuses is allowed here, compared seed by seed. 46 rows are refused here that main allows under every seed, all of them attacks that point at this host (measured with the command passed in its written case, asis_denieddoes). 32 rows change with the hash seed, the same 32 as on main. Local runs on this head (-n 8 --dist loadgroup): the 24 test files that import the ssh floor,argv_rules,deny_gateorshell_commandspass (3,110 passed), including #37558's main-refused corpus;test_flake_pattern_ratchet.pypasses; isort, black, flake8, docs-lint, comment-history, brand and file-line-cap gates are clean;mypy --platform linux src/kiro_crewis clean.Proof: PROVEN test/test_denied_commands_security_ssh_self.py::TestSandboxEscapeSshSelf::test_a_run_glob_verb_keeps_its_glob_host[s?h -F /dev/null local* id], test/test_denied_commands_security_ssh_self.py::TestSandboxEscapeSshSelf::test_a_run_glob_verb_keeps_its_glob_host[s?h local*], test/test_denied_commands_security_ssh_self.py::TestSandboxEscapeSshSelf::test_a_run_glob_verb_keeps_its_glob_host[s?h local* id], test/test_denied_commands_security_ssh_self.py::TestSandboxEscapeSshSelf::test_a_run_glob_verb_keeps_its_glob_host[s[s]h local* id], test/test_denied_commands_security_ssh_self.py::TestSandboxEscapeSshSelf::test_a_run_glob_verb_keeps_its_glob_host[env s?h local*] (head cdca772)
Manual verification
N/A — the floor is a pure function of the command text; the tests call
is_deniedon each command directly.Related Issues
Follow-up to #33299. Found on #33675. Gaps main shares are tracked in #37009 (runner-started globs, the
strace -koption reading, multi-program globs whose answer depends on the hash seed, thecp/mv/ln/installcopy path, and a quoted>in a one-program-o proxycommand=). Interacts with #33418 (which makes_ssh_family_verbdeterministic): the two touch the same function and conflict textually, so whichever merges second rebases; #33418 is also what removes the hash-seed dependence. Needed onrelease/0.12.0too: the pick f24c5dc from #34021 carries the sameglob_verbline.Sibling sweep
Swept: git grep -n "match_globs=not|glob_verb" -- src/
Sibling: src/kiro_crew/security/argv_floor_ssh.py:1320 -- changed here -- the first operand check reads the same
glob_verbflagSibling: src/kiro_crew/security/argv_floor_ssh.py:1457 -- changed here -- the second operand check reads the same
glob_verbflagPattern harvest
Not generalizable: the exemption was one predicate's trade; the fix moves it to the shell's own run position, resolved by the existing wrapper resolver.
Sensitive change review
Draft for the PR author to confirm on the current head; the author posts it.
sandbox-escape-ssh-selfkeeps glob host matching for a glob verb that bash runs (program position or a wrapper's program), instead of turning it off for every bare glob verb.s?h -F /dev/null local* idand its wrapper, subshell and substitution forms were allowed; now refused. A glob in another program's operands keeps main's answer.tar/git add/find/mypy/pytestlines over globs andfiles=$(ls s* l*)keep main's answers.s?h local*, moved to refused on purpose.Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.