Repository navigation
fix: make a command check give the same verdict in every process - #33418
bolichen97 wants to merge 1 commit into
Conversation
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
43b5496 to
907adca
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The fix goes at the root cause: the verdict depended on the order a frozenset was walked in, and now every verb the glob can name is judged, toward deny. The rename of Notes
[DESIGN-REVIEWED] 1e896c2 Description read[DESCRIPTION-READ] d0bda4f18419b5a312ad0276408f72d2593e077724ba3c3a7f938345188b7c65 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 Nothing blocks. The fix removes the order-dependent verdict at its mechanism, the first-match loop over a frozenset, and the per-call memo is reused rather than duplicated. What this change shipsInventory (8 items) — 8 justifiedIntent: a refused command stays refused no matter which gateway process judges it. FIX (#25848; the seed-0/3 subprocess test fails on base).
[FIRST-PRINCIPLES-REVIEWED] 1e896c2 Description read[DESCRIPTION-READ] 6468aa07b26956d47bd4ef506030b8a1360d57a7e81d1cb3e9ad23c0e36bac18 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 — ✅ 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: |
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 change closes an ordering bypass. A glob command word that can name several ssh-family verbs ( TIGHTENING: ssh self-target floor ( ADJUDICATED: 22 candidates, 0 confirmed newly-refused PLATFORM COVERAGE:
No platform assumption in the diff was left without a candidate. UNADJUDICATED:
[SCOPE-REVIEWED] 1e896c2 The confirmed rows, in the committed corpus's own shape{
"golden_paths": [
{
"kind": "shell",
"command_or_flow": "find ~/.ssh -name '*' -type f -newer ~/.ssh/config",
"platform": "posix",
"reason": "an operator listing recently changed ssh files during a key rotation; a quoted lone * operand followed by more words"
},
{
"kind": "shell",
"command_or_flow": "tar -czf certs.tgz * localhost.pem localhost-key.pem",
"platform": "posix",
"reason": "a developer archiving mkcert-generated localhost dev certificates alongside a project; bare * followed by localhost-named files, not hosts"
}
]
} |
buluoray
left a comment
There was a problem hiding this comment.
Approve on 907adca. A glob program word like s?? used to be judged as whichever ssh-family verb came first in a hash-seed-dependent frozenset walk; now every verb it can name is judged and any refusal refuses (security/argv_floor_ssh.py:587-622, :1137), with nested payloads memoised per outer call (:963-982). Verified deterministic and toward-deny across hash seeds. Still needs owner action: Security Scope red on the macOS /usr/bin/s?? remote.example.com id row (uncached host, fail-closed, same as plain ssh; declared Breaking, owner override) and Sensitive Change Review for src/kiro_crew/security/.
907adca to
1f3a918
Compare
|
Rebased: main moved in test/test_security_gate_liveness.py and docs/system-specs/modules/security.md since this head went green (8d04c52 -> 4de745e); CI re-running. The package line budget conflicted with main's raise for |
|
self-added: yes
|
|
676bbb3 to
d273370
Compare
|
Rebased: main moved in test/test_security_gate_liveness.py and docs/system-specs/modules/security.md since this head went green (4de745e -> 510ba1b); CI re-running. The package line budget conflicted with main's raise for |
|
|
|
[operator: bolichen97] The red
|
|
Re-sync budget reset: this PR is inside its 48-hour watch window, conflicts with main again (test/test_security_gate_liveness.py), and needs main's mypy fix (#36457) to clear its red lint check, so it gets another three re-syncs to stay green. [operator: bolichen97] |
d273370 to
1e896c2
Compare
|
Rebased: main moved in test/test_security_gate_liveness.py and src/kiro_crew/security/ since this head went green (510ba1b -> 187b4da); CI re-running. The package line budget conflicted with main's raise for |
|
|
Problem / Motivation
Goal: the same command gets the same security verdict in every Kiro Crew process, and that verdict is the cautious one.
A security check could refuse a command in one gateway process and allow the identical command in the next one. Reported in #25848.
Why it matters
A command this check exists to refuse could get through, depending only on which process happened to judge it. Every gateway start is a new roll.
Not a goal
casepattern apart from a program name (see Backwards compatibility).What changed (motivation → approach → change)
A command this check should refuse could pass in some processes, because the check picked one of the command's readings by chance. Now it judges them all, so every process refuses it.
The change is in
src/kiro_crew/security/, with a test intest/that runs the same commands in fresh processes and a row intest/security_line_budget/for the lines the package grows by. Judging every reading costs one pass per reading, and each nested part of a command is judged once per check through the check's existing per-check memo, so the readings do not multiply as commands nest. The security spec indocs/lists that reader. It takes the core of #25993 and one of that PR's later additions, and leaves out the rest.Builds on #25993 by @CrysisDeu.
Backwards compatibility
Breaking: a few command lines the check already refused in some processes are now refused in every process, for example
case "$1" in s?? ) cp a localhost: ;; esac, or a line that quotes a cron schedule and later has a0orlocalhostword (30 4 * * * /opt/cleanup.sh --keep 0), or a line whose lone*word, read asssh, reaches this machine (tar -czf certs.tgz * localhost.pem localhost-key.pem,find ~/.ssh -name '*' -type f -newer ~/.ssh/config). A glob program word that can namesshgetsssh's answer:/usr/bin/s?? far.example.com idis refused, asssh far.example.com idis, until the name's lookup finds it is not this machine. Writer sweep on origin/main @ 31b0c76: no shipped skill, doc or script line puts a glob program word or a lone*before a word that names this machine, so none sends such a line through the check.Removes nothing: only private names change; no key, field, setting or public function is removed.
Tests
Determinism: the changed test files pass under
PYTHONHASHSEED0, 1, 2 and 3, and in two shuffled orders (498 passed each).Proof: PROVEN test/test_denied_commands_security_ssh_self.py::TestSandboxEscapeSshSelf::test_glob_naming_several_verbs_is_judged_as_each_in_every_process, test/test_denied_commands_security_ssh_self.py::TestSandboxEscapeSshSelf::test_nested_payloads_of_a_multi_verb_glob_are_judged_once (head 29695945d325)
Manual verification
On Linux (Ubuntu 24.04, Python 3.12), each command ran through the check in eight fresh processes (
PYTHONHASHSEED0 to 7). The tool gate a Bash call goes through refused/usr/bin/s?? x localhostunder seeds 0, 2 and 5 on this branch, where main allowed it under seeds 2 and 5, and auto-approvedls -laon both./usr/bin/s?? x localhost/usr/bin/s* x ::1caselinecp /usr/bin/s?? /tmp/q && /tmp/q x localhostssh -V,ls -la,git status,tar -czf src.tgz src,find . -name '*.py' -type fRelated Issues
Closes #25848
Sibling sweep
Swept: every loop over a set of program names in the same check
Siblings: none -- the other loops ask whether any name matches, which does not depend on order
Pattern harvest
Rule candidate: review-prompt
Pattern: a security decision that takes the first match from a set, so its answer follows the process's hash seed
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)