Repository navigation
fix: close a gap in how the command check reads nested commands - #30736
Conversation
For one shell spelling the command check stopped reading a nested command before the shell does, so the rest of it went unchecked and a command the check refuses in its plain form was allowed. The check now reads that spelling to the same end the shell does, and never reads less than it did before.
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) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the reader is a shared extractor that treats a longer span as safe, and taking the longer of the two readings keeps it from ever checking less of a command than before. Notes
[DESIGN-REVIEWED] e6c7944 Description read[DESCRIPTION-READ] c508a8db7becbc07d6edc40995d3b8be56a6b98f3541e9bb23a5636fe98b2e92 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: a linked issue (#9181), a fix in the one shared reader all five callers use, and tests that fail on base. What this change shipsInventory (3 items) — 3 justifiedIntent: stop a command the policy refuses from slipping through when it is written inside a
[FIRST-PRINCIPLES-REVIEWED] e6c7944 Description read[DESCRIPTION-READ] 8439ac65dc5ae297a550eaf60968628d532edcae0cb8a8a76edb5278b2a7a619 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 findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/security/shell_normalizer_walk.py:864 -- Heredoc data extends a substitution into unrelated commands
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 — LOW. The only outcome is a false refusal, and the user sees it. Bash itself still kills only 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: The change only lengthens a substitution body when the TIGHTENING: ADJUDICATED: 18 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix (15 rows) covers the bash grammar the walk now models: [SCOPE-REVIEWED] e6c7944 |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved: T1 fix, lanes and checks clean on this head.
For one shell spelling the command check stopped reading a nested command before the shell does, so the rest of it went unchecked and a command the check refuses in its plain form was allowed. The check now reads that spelling to the same end the shell does, and never reads less than it did before. (cherry picked from commit 165dbc0)
For one shell spelling the command check stopped reading a nested command before the shell does, so the rest of it went unchecked and a command the check refuses in its plain form was allowed. The check now reads that spelling to the same end the shell does, and never reads less than it did before. (cherry picked from commit 165dbc0)
Problem / Motivation
Goal: Make the command check read a nested command as far as the shell runs it, so a command it refuses in its plain form is still refused when written another way.
For one shell spelling the command check stopped reading a nested command before the shell does. The rest of that command went unchecked, so a command the check refuses in its plain form was allowed.
Why it matters
The command check is one of the layers that keeps an agent from running a command the operator's policy refuses. Any spelling that hides part of a command from it lets that part through.
Not a goal
What changed (motivation → approach → change)
The check now reads the spelling the issue names to the same end the shell does, nested parts included. It keeps the longer of its old and new readings, so it never checks less of a command than before. The change sits in the shell reader in
src/kiro_crew/securitythat every check shares, and onetestcovers it.It builds on #23620 by @iamwhatever and is smaller: there is no fallback to the old reading, so the cases where that fallback brought the short reading back do not arise.
Backwards compatibility
Compatible: the check only reads more of a command than before, never less, so a command allowed today is refused only when the newly read part holds a refused command.
Removes nothing: no rule, key or public function is removed or renamed.
Tests
Determinism: 20 repeats at
-n0and 10 at-n 4 --dist loadgroupwith two sibling files, all green; the whole file in a shuffled order (seed 25108) green.Proof: PROVEN every case of the four-spelling test fails without the fix (head e6c7944)
Manual verification
Each spelling in the test was run through bash to confirm where bash ends the nested command; the check now ends it at the same place.
Screenshots / video
N/A — no frontend change.
Related Issues
Closes #9181
Builds on #23620 by @iamwhatever.
Sibling sweep
Siblings: none -- every check reads nested commands through the one shared reader this changes
Pattern harvest
Not generalizable: a one-off gap in reading one shell construct, in the single shared reader
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement