Repository navigation
Conversation
Sensitive change review
|
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)Design-level review of Design-Verdict: PASS The description says no BlockersThe description and the diff disagree on the core design of the floor.
Fix: pick one design. Either remove the tracker so the code matches the description and its safe-side cost list, or rewrite the
Notes
[DESIGN-REVIEWED] 0f2ca4f Description read[DESCRIPTION-READ] 7a91925d3deb2a4baad410175de805579b104981e592fc6fa4010a0bce1232cb 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) — 🔴 BLOCKPremise-level review of First-Principles-Verdict: BLOCK The description says no Notes
What this change shipsInventory (10 items) — 7 justifiedIntent: make the ssh-to-self floor give the same seed-independent verdict for a glob program word, refusing if any verb it can name reaches this host. FIX.
BlockersThe case-pattern skip contradicts the description — framing contradicted by diff [FIRST-PRINCIPLES-REVIEWED] 0f2ca4f Description read[DESCRIPTION-READ] 5d46fe6380e4059e628bb12af4c1fc838908e46ba33e3b130be3d6ad30d1f34c That sha256 names the PR description this verdict read. 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 — 🔴 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_ssh.py:635 -- Nested case state skips an executable copied SSH client
[BLOCK-MERGE] 0f2ca4f Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 (fenced): UPHOLD-FENCED. The defect is real and the input that triggers it is ordinary shell text the agent could write.
False positive or not applicable? A repository writer can comment: |
6550249 to
aecb389
Compare
Sensitive change review
|
Security Scope Review -- 🔴 BLOCK (blocking)Which legitimate operations does Verdict basis: a script-confirmed newly-refused operation. Security scope review -- adjudicated candidates
Newly refused (confirmed by the real classifier at both refs)
Each row above is an operation that the base ref ALLOWS and this change REFUSES. Narrow the rule at the tier named. Withdrawing a row is not the way to green: that is its own pull request, on its own merits. Scope-Verdict: PASS Reason: The harness returned no confirmed regressions for this run, so nothing here was script-confirmed. One narrowing is argued but not confirmed: the PR's own tests now expect TIGHTENING: ssh-to-self argv floor, how a glob is resolved when it sits where a program name goes -- it now refuses a glob program word that can name several ssh-family verbs, judging it as each of them instead of whichever one the hash seed happened to give first. The hunk: ADJUDICATED: 30 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix (23 rows): UNADJUDICATED: The new memo [SCOPE-REVIEWED] 6d613dd The confirmed rows, in the committed corpus's own shape{
"golden_paths": [
{
"kind": "shell",
"command_or_flow": "case \"$mode\" in build) make ;; *) ls -la * ;; esac",
"platform": "posix",
"reason": "An agent writes a mode dispatch inline when it scripts a build-or-inspect step; the catch-all arm listing the working directory is the most common case fallback."
}
]
} |
aecb389 to
1b7bbc9
Compare
Sensitive change review
|
1b7bbc9 to
c323eec
Compare
Sensitive change review
|
c323eec to
3407013
Compare
Sensitive change review
|
|
Security Scope Review on 04d1bff: the four newly refused rows ( New since the last head: the lane now confirms them on the Ubuntu leg as well as macOS, and the prettier row is a new spelling of the same shape. The description's "Safe-side cost" list is updated. The narrowing the lane suggests (skip a |
04d1bff to
41ec128
Compare
Sensitive change review
|
|
Security Scope Review on 41ec128: the four confirmed rows ( |
41ec128 to
203f587
Compare
Sensitive change review
|
A glob program word such as s?? or * can expand to more than one ssh-family verb. _ssh_family_verb looped over a frozenset and took the first match, so the verb, and with it the verdict, followed PYTHONHASHSEED: /usr/bin/s?? x localhost was refused under some seeds (read as scp, which checks every operand) and allowed under others (read as ssh, which checks only the first). The operand walk now visits such a token once per verb it can name, in sorted order, and refuses if any reading reaches this host. The choice is local to the token, so the cost grows linearly and no line-wide combination cap is needed. A cp/mv/ln copy of a multi-verb glob binds its destination to the whole verb tuple.
Sensitive change review
|
Sensitive change review
|
Walking a glob program once per verb it can name reaches the same nested -e / proxycommand / RSYNC_RSH value from every walk, so a three-level proxycommand line with 24 globs took 64 s. _is_ssh_to_self now keeps the verdicts of nested payloads, of operands and of hosts-file lookups for the length of one outer call, so each is judged once. The same line walks 3 frames and takes 0.2 s. Every verdict is a pure function of the text and of state read in that call, and nothing is kept between calls. A word ending in ")" is judged like any other word. A case pattern and the program word of $(which r*) or (xargs s??) split the same way, so ssh) is ssh and *) is every ssh-family verb, even as a case pattern.
|
[operator: bolichen97] Continuing this in #33418; thanks for the start. |
Problem / Motivation
Goal: the ssh-to-self deny floor gives the same verdict for a glob program word (
s??,*,[rs]*) in every Python process, and refuses when any program the glob can name would reach this host._ssh_family_verbresolved a glob basename by looping over the_SSH_FAMILY_VERBSfrozenset and returning the first match. Frozenset order followsPYTHONHASHSEED, sos??was read asscpin some processes andsshin others.scpchecks every operand;sshchecks only the first. So/usr/bin/s?? x localhostwas refused under seeds 0, 1, 3, 4 and allowed under 2 and 5.The same cause flips
* stash *(seen in a deny-corpus run): on main it is refused under seed 3, 4 and allowed under 0, 1, 2, 5, because*as a program was read as scp (checks the glob operand*as a host) or ssh (checks onlystash). With this fix it is refused under every seed, like other glob hosts.Why it matters
This is a sandbox-escape floor: an allowed
s?? x localhostlets bash expand the glob toscp ssh x localhost(or similar) and open a channel back into this host. The same command could pass on one gateway start and be refused on the next.Not a goal
Brace and extglob program words (
{scp,ssh} x localhost,s@(cp|sh) ...). The review found these are allowed on main too; this PR does not change them.A glob program glued to a substitution opener (
echo $(s?? x localhost)). The pre-walk gate_glob_can_name_ssh_verbmatches$(s??as a whole word and skips the walk. Allowed on main under every seed too; unchanged here.Changing which operands each verb checks.
A host given only by a run-time substitution, e.g.
ssh $(case $x in *) echo ::1;; esac) id. This is the floor's documented run-time residual on main (_static_substitution_outputresolves only echo/printf bodies); this PR does not try to close it.A word ending in
)is judged like any other wordA case pattern and a program word split the same way:
case $x in *) …gives*),$(which r*)givesr*),(xargs s??)givess??). A case-context tracker and a "glob)words name no program" rule were both tried, and blind reviews found bypasses in both. With the tracker, the wordscase/inpassed as plain arguments made$(which ssh) localhostread as a pattern. With the glob rule,(s?h),$(which r*)and(xargs s??)stopped naming a program (294 commands main denies became allowed). So no)word is skipped:ssh)isssh, and*)is every verb it can name.Safe-side cost (refused on this PR):
case $x in ssh) ssh localhost;; esac(a case line that names this host).case "$mode" in clean) rm -f *.o ;; *) tar czf out.tgz * ;; esaccase "$1" in *) cp * /backup/ ;; esaccase "$1" in -h|--help) echo usage ;; *) ls -la * ;; esaccase "$f" in *.py) black "$f" ;; *) git add * ;; esaccase "$f" in *.py) ruff check "$f" ;; *) prettier --check * ;; esacbash -c 'case "$1" in *) ls -la * ;; esac'(the samelsline insidebash -c; Security Scope Review's Windows leg on 41ec128.deny_diff.py, main 934f7a8 vs 41ec128, fresh process per ref, PYTHONHASHSEED 0 and 2: allowed on main, refused here; 0 commands main refuses become allowed.)The
*)lines are case arms with a later glob operand. On head 04d1bff Security Scope Review confirmed four of them (tar, cp, ls, prettier) as newly refused on both its macOS and Ubuntu legs (0 on Windows);deny_diff.pyagainst main af11620 at PYTHONHASHSEED 0 and 2 gives allowed on main, refused here, for all five, and 0 main-refused commands allowed: read as scp/rsync,*)checks the*operand, which can expand to this host's name. On main their verdict depends on the hash seed:*)is read as whichever verb the frozenset yields first, so they are allowed under some seeds and refused under others.Cost on extreme glob lines
Each multi-verb glob word walks the rest of its command once per verb it can name, so a line made almost only of glob words costs more than on main. Main's walk is already quadratic here. Verdicts match main.
ssh+ 300 glob words (1.4 KB)ssh+ 600 glob words (2.8 KB)ssh+ 3,900 glob words (18 KB)A running gate call has no time limit; the only 15 s limit is the wait for a free worker. So the 18 KB line runs to its real verdict on both. This is an availability cost on an extreme input only, the same class as the self-kill window tracked in #18385 (numbers added there).
Intended? / Repro
Intended? No. The floor documents glob program words as "read toward deny, like a glob host"; a verdict that depends on the hash seed is not a design choice.
Repro (main
043dd9fd7f):src/kiro_crew/security/argv_floor_ssh.py:564-566:for verb in _SSH_FAMILY_VERBS: if fnmatch.fnmatchcase(verb, base) ...: return verb.PYTHONHASHSEED=0→_is_ssh_to_self("/usr/bin/s?? x localhost")isTrue(read as scp).PYTHONHASHSEED=2→False(read as ssh).What changed (motivation → approach → change)
Symptom: seed-dependent verdict. Cause: first match from a set. Change: judge every verb the glob can name, at that token.
_ssh_family_verbs(token): every ssh-family verb a token can invoke, in sorted order (s??→("scp", "ssh"),*→ all four)._ssh_family_verb(token): the first of those in sorted order, never a set's order._frame_verb_choices: the operand walk visits a multi-verb token once per verb it can name and refuses if any reading reaches this host. The choice is local to the token, so no line-wide combination of choices is built.cp/mv/lncopy of a multi-verb glob binds its destination to the whole verb tuple._glob_can_name_ssh_verbiterates the sorted tuple too (itsanyanswer was already order-free)._is_ssh_to_selfis wrapped by_shares_nested_verdicts, which keeps the verdicts of nested payloads (-e, proxycommand,RSYNC_RSH, xargs rebuilds) for the length of one outer call, in aContextVar(_SSH_SELF_VERDICTS). The walk itself stays in_is_ssh_to_self, so its one frame loop and per-frame memo are where the cost test expects them._OPERAND_VERDICTS, keyed on the exact operand and position, around_judge_operand) and hosts-file verdicts (_HOSTS_FILE_VERDICTSinargv_floor_hosts, keyed on the exact host). Both are opened and reset infinallywith_SSH_SELF_VERDICTS, and are never shared across calls or threads._unmask_separatorsreturns early when no separator marker is present.src/kiro_crew/security/argv_floor.py: nine owner names join theTYPE_CHECKINGmanifest.test/test_security_gate_liveness.py: the package line budget is raised by 108 (33,172 → 33,280) with a note naming the additions. Without it, walking each glob once per verb re-walked the same nested payload from every walk: a three-level proxycommand line with 24 globs took 64 s (2 s on main). It now walks 3 frames and takes 0.2 s.Other design considered: walking the whole line once per combination of verb choices, with a cap. The first review rejected it: cost grew as a power of the glob count, and the cap refused harmless lines like
echo * s* *s* *p* [rs]*.Security
area: security, the ssh-to-self sandbox-escape floor. The change only adds refusals: glob program words that one of their verbs would refuse, and the safe-side case lines listed above. The memos hold booleans for one call and are reset infinally.Independent review: two blind, read-only reviews of the diff and the issue.
)words): a case-context tracker had a Critical (plaincase/inarguments opened a fake pattern slot) and was dropped; a "glob)words name no program" rule had a High (294 main-denied commands allowed) and was dropped. The final round, on this head, is clean: 0 main-denied commands become allowed over about 16,000 inputs on seeds 0 and 2, all 294 rows above are refused, the memos change no verdict (re-run with memos disabled: 0 of 15,969 differ) and leave nothing set after allowed, refused or raising calls or across 8 threads.s??,s*,*,[rs]*,s[cs]?, sudo/env/xargs/RSYNC_RSH/proxycommand/cpshapes, and thatecho/ls/cp *lines ands?? remote.example.com idstay allowed.Backwards compatibility
Compatible: a literal program name (
ssh,/usr/bin/scp,ssh.exe) resolves to the same single verb as before. Only glob program words that can name several verbs are judged differently, toward deny.Removes nothing: no key, field or error path is removed.
Tests
test/test_denied_commands_security_ssh_self.py:test_glob_naming_several_verbs_is_judged_as_every_verb:s??,s??.exe,s*,[rs]s*, a glob program inside a*)case arm,* stash *, and acpcopy ofs??aimed at this host are refused.test_a_literal_verb_ending_in_a_paren_is_that_verb:$(which ssh) localhost,(xargs ssh) <<< localhost,(ssh localhost),$(which scp) …, theenv -u case -u in …andecho case in x;; …shapes, and the four safe-side case lines above are refused.test_glob_naming_several_verbs_stays_allowed_off_this_host: the same globs aimed at a remote host,ls *,cp * /backup/stay allowed.test_glob_verbs_are_every_verb_in_sorted_order:_ssh_family_verbs/_ssh_family_verbanswers.test_many_verb_capable_globs_in_data_stay_allowed:echo,ls,rmlines with many globs are allowed.test_nested_multi_verb_globs_walk_each_payload_once: 3-level proxycommand and rsync-elines with 4 and 24 globs tokenize each payload once.test_nested_payload_verdicts_do_not_outlive_the_call: all three memos readNoneafter the call.test_glob_verb_verdict_does_not_depend_on_the_hash_seed: runs the check in fresh interpreters under seeds 0, 2, 5.On main the repro and hash-seed tests fail.
Proof: not provable -- other: this host runs no local tests; CI runs the new tests
Manual verification
N/A beyond the review probes above. Static gates run locally: black, isort, flake8, mypy,
scripts/check_file_line_cap.py. Tests run in CI.Related Issues
Fixes #25848
Sibling sweep
Swept: git grep -n "for verb in _SSH_FAMILY_VERBS|next(iter(" -- 'src/kiro_crew/security/argv_floor*.py'
Sibling: src/kiro_crew/security/argv_floor_ssh.py
_ssh_family_verb-- changed here (first match from a set)Sibling: src/kiro_crew/security/argv_floor_ssh.py
_glob_can_name_ssh_verb-- changed to the sorted tuple (itsanyanswer was already order-free)Sibling: src/kiro_crew/security/argv_floor_ssh.py
any(verb in probe for verb in _SSH_FAMILY_VERBS)-- not affected (anyis order-free)Sibling: src/kiro_crew/security/argv_floor_hosts.py
next(iter(_HOST_VERDICT_CACHE))-- not affected (dict eviction order, not a verdict)Pattern harvest
Rule candidate: a deny floor never takes "the first match" from a set or frozenset; iterate a sorted tuple, and when several matches are possible, judge every one toward deny.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.