Repository navigation
fix(security): read backtick bodies and glued redirects in the rm floor - #23292
Conversation
|
Local pre-push review (hand-written charters; the brief extractor reported a parity failure, so this is approximate to CI).
|
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 change stays inside the Notes
[DESIGN-REVIEWED] ac702f0 Description read[DESCRIPTION-READ] b1ed2bb24fa8729b3090b350e4a6b7d38016095019eac56237216e40d2498d08 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 Each item is aimed at a reported mechanism (#21365) and reuses the shared shell helpers. One undeclared rider is needed: without it, splitting glued redirections would let Notes
What this change shipsInventory (5 items) — 5 justifiedIntent: stop the
[FIRST-PRINCIPLES-REVIEWED] ac702f0 Description read[DESCRIPTION-READ] 575ee9c2cff62279afc4311aedf13a1462869a5b61e307081f3a720558efd1bd That sha256 names the PR description this verdict read. Recompute it with |
Sensitive change review
|
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 -- ✅ 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 tightens only the shell-command TIGHTENING: ADJUDICATED: 20 candidates, 0 confirmed newly-refused PLATFORM COVERAGE:
[SCOPE-REVIEWED] ac702f0 |
|
CI note for head 40e4ed3: |
40e4ed3 to
84d08f7
Compare
|
Rebased once onto main for the #23264 Windows fix. |
84d08f7 to
8d1d739
Compare
Sensitive change review
|
|
Applied the subtraction from the First Principles BLOCK on
Fixed in head |
8d1d739 to
e861cc6
Compare
|
Fixed the blocking regression Opus flagged on
Fixed in head |
|
Rebased onto fresh main (which picked up a security gate) to clear a DIRTY merge conflict; resolved the package-line-budget comment to keep both the new entry and this PR's, budget recomputed to 32_509. New head e25cbf0, no behaviour change. |
Sensitive change review
|
e25cbf0 to
ac702f0
Compare
|
Rebased onto fresh main to clear a DIRTY merge conflict; resolved the package-line-budget comment to keep both the new entry and this PR's, budget recomputed to 32_518. New head ac702f0, no behaviour change. |
Sensitive change review
|
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed current head ac702f031642c70a90d2bb1940619420ef175eb0 as Tier 2. Deep review found no blocking issue.
Security check: the destructive-command floor now reads backticks and glued redirects. Parser failures still deny independent rm commands. Non-command text remains allowed. Auto-merge remains subject to branch protection.
Problem / Motivation
Goal: The recursive-force
rmfloor reads a command substitution written with backticks inside double quotes, and a redirection glued to an operand, the same way it reads their other spellings; when it cannot read a command, it refuses only one that namesrmas a word.Follow-up to #18415. Three behaviors of
rm_floor, checked throughis_deniedon main:$(…)form in the same position was./>/dev/null) was read as part of that operand, so the operand no longer matched root or home.r…mpre-check matched was refused. That pre-check also matches the letters inside words likeformat, sogit log --format=$xwould have been refused on that path.Why it matters
The floor exists to refuse recursive-force removal of
/and~in its common spellings. Two spellings of the same command were read differently from their equivalents, and the error path refused ordinary commands that have nothing to do withrm.Not a goal
sudo,env),bash -cpayloads, heredocs, arrays and parameter-expansion defaults. These stay out of scope for this floor, as the spec already says; the catalog rows and the OS sandbox cover them.rm_floor.pyand its call site.What changed (motivation → approach → change)
The floor's segment walk handled
$(…)inside double quotes but not backticks, and it treated</>as ordinary word characters. Its error path keyed on a pre-check that matchesrmanywhere in the text.$(…), then the double quote resumes<or>rmoperandrmappears as a word of its own (_names_rm_word: a path prefix and quote splices allowed, checked on the raw text and with${X:-…}defaults resolved); other commands passThe change is in
src/kiro_crew/security/rm_floor.pyand its error branch insrc/kiro_crew/security/deny_gate.py. The security spec's Recursive-forcermfloor paragraph now describes the backtick and redirection reads and the error path, and no longer lists glued redirections as out of scope.Backwards compatibility
Compatible: the floor denies the same targets with the same flags. It now reads two more spellings of a command it already refuses, and its error path refuses fewer unrelated commands.
Removes nothing: no rule, row or allowed command is removed. The error path refusing fewer commands narrows a fail-closed path, which no caller depends on to refuse a non-
rmcommand.Tests
In
test/test_denied_commands_security_rows.py::TestRecursiveForceRmFloor:echo "\rm -fr ~`", with text before it), and an operand with a glued>or<` redirection, for both root and home.rm, followed by quoted text naming the command; a backtick inside single quotes; a glued redirection after a non-root operand./bin/rm -fr /and the${X:-rm}/${X-rm}parameter-default spellings are still refused, andgit log --format=$x,make format,docker run --rmand a--platformflag pass.Nine of these cases are red on main and green with the fix.
test/test_security_gate_liveness.py: the package line budget is raised by 27 lines with its reason recorded beside it.Determinism: the class passed 20× at
-n0, 10× at-n 4 --dist loadgroup --max-worker-restart=2alongsidetest_denied_commands_hooks.pyandtest_denied_commands_security_quoting.py, and once in a seeded shuffle (seed 816, 57 ids).Manual verification
N/A — unit coverage sufficient: every changed path is reached through
is_denied, the same entry point the tool-call gate uses.Related Issues
Closes #21365
Sibling sweep
Swept: git grep -nE "_segments(|_rm_wipe_targets|_can_fire" -- src/
Sibling: src/kiro_crew/security/rm_floor.py -- changed here
Sibling: src/kiro_crew/security/deny_gate.py -- changed here
Sibling: src/kiro_crew/security/shell_normalizer.py -- tracked in #21345
Pattern harvest
Not generalizable: the backtick and redirection reads mirror an existing
$(…)branch in this one floor's own segment walk; the shared walker that other floors use is tracked separately in #21345.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)