Repository navigation
fix(kas): backport #31892 #33045 #33478 to 0.12 (allowedCommands regex, read allowedPaths) - #34820
Conversation
…ts allows after every deny (#31892) Original author: Joe Guo (#31892) Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com> (cherry picked from commit b8b90c4) Backport note: three hunks resolved by hand, because release/0.12.0 has no kiro-cli alias folding (#30193's tools_settings_aliases module; only its fail-open part was ported, in 21b747d). - kas_permissions.py: comment-only conflict in the web_fetch branch; kept the release text. - kas_tool_view.py tools_settings_unenforced: ported the \d \s \w "inexact" naming over the raw execute_bash/shell keys, without canonical_tools_settings / as_authored. - agent-spec-fields.md toolsSettings row: applied main's two syntax edits to the release text. - test_kas_tools_settings_aliases.py: dropped; the file is not on release (alias-only tests). The ASCII-class naming is covered on release by test_mate_spec_policy.py.
…33045) On KAS a toolsSettings fs_read/read allowedPaths granted nothing and the session-start notice named it. Crew now records the usable entries under _crewAnsweredReadPaths, the way #31850 records the write ones, and the spec-builtin-grant row approves a KAS read_file of one existing file an entry covers as written and symlink-resolved. A missing target, a ~user target, a listing, grep/glob and every other read keep main's answer; a deniedPaths or other read key withholds the grant and names it. Closes #33041 Original author: Joe Guo (#33045) Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com> (cherry picked from commit d170e63) Backport note: hunks resolved by hand, because release/0.12.0 has no kiro-cli alias folding (#30193) and no CREW_ANSWERED_WRITES_KEY. - kas_agents.py imports: added CREW_ANSWERED_READ_PATHS_KEY only; CREW_ANSWERED_WRITES_KEY is main-only and unused here. - kas_agents.py spec_keys_without_carrier: took main's fs_write/fs_read loop, naming the key as written ({key}) instead of as_authored. - agent-spec-fields.md toolsSettings row: added main's read.allowedPaths sentence and grep/glob wording to the release text. - test_kas_tools_settings_grants.py: dropped the fsRead alias case from test_a_read_inside_allowed_paths_is_answered_by_the_grant; the alias is read only with #30193's folding.
…33478) - kas-allowed-commands-regex-dropped: Kiro Crew's gate now reads the Rust regex syntax kiro-cli accepts in toolsSettings.shell allowedCommands (POSIX classes, \d \w \s \b, counted and lazy repeats, flags, named groups), so denyByDefault no longer refuses a command kiro-cli runs. What Rust refuses to compile stays refused, a repeat count past 4294967295 included, since kiro-cli then allows nothing by the entry. An entry it still cannot read is named with the reason in the refusal, the session-start notice and doctor. A deniedCommands entry read by ASCII that cannot judge a non-ASCII command never hides another entry that names it. - kas-oversized-exclude-allow-dropped-silently: a permissions allow whose exclude lists more than 64 patterns is still left out of the KAS block, but the session-start notice now names it as permissions.rules[<i>] and says why, so a prompt it causes is no longer a mystery. The subagent toolsSettings rules move from kas_permissions to kas_subagent_rules, keeping kas_permissions under the line cap. Original author: Bolin Chen (#33478) (cherry picked from commit ddb535e) Backport note: hunks resolved by hand, because release/0.12.0 has no kiro-cli alias folding or trusted_agents_withheld (both from #30193; only its fail-open part was ported, in 21b747d). - kas_agents.py spec_keys_without_carrier: took main's authored / name_unreadable_entries / projection_dropped_rules lines, naming keys as written (no as_authored) and without the trusted_agents_withheld line. - kas_permissions.py: took main's move of _agent_glob and _available_agents_rules into kas_subagent_rules; the import no longer re-exports trusted_agents_withheld. - kas_subagent_rules.py (new): left out trusted_agents_withheld and its tools_settings_aliases import; the two moved helpers are identical to release's. - kas_unread_commands.py (new): docstring no longer cites canonical_tools_settings. - kas_tool_view.py: main's ascii_only docstring without the alias sentences; unreadable_allowed_commands reads raw toolsSettings instead of the alias-folded view. - agent-spec-fields.md: main's allowedCommands sentence and permissions.rules[<i>] wording applied to the release rows. - test_kas_tools_settings_aliases.py: dropped (not on release).
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 PR replays three fixes already merged on main, the hand-resolved hunks keep main's design, and the moved helpers are still importable from Notes
[DESIGN-REVIEWED] 6f4b80a Description read[DESCRIPTION-READ] efda224e1c4450072b4a672b1e99b6a1a3d3a1197f6148d3b86dc3ab3cc88d08 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. Every item is a straight backport of a fix already merged on What this change shipsInventory (7 items) — 7 justifiedIntent: let a kiro-cli agent's regex
[FIRST-PRINCIPLES-REVIEWED] 6f4b80a Description read[DESCRIPTION-READ] 43248799b3996a14119cb42ccdb2d7c08537e7f43901e2185c6ce42abad7494b That sha256 names the PR description this verdict read. Recompute it with |
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: |
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: |
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 diff doesn't touch the shell deny tiers ( TIGHTENING: ADJUDICATED: 21 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix and windows have separate rows wherever the operation names a path, a separator or an executable:
UNADJUDICATED:
[SCOPE-REVIEWED] 6f4b80a |
Problem / Motivation
Goal: Bring three KAS fixes merged on
main(#31892, #33045, #33478) ontorelease/0.12.0, so a kiro-cli agent'sallowedCommandsregexes and readallowedPathsauto-approve under Kiro Crew on KAS as they do in kiro-cli.A Slack user on 0.12.1.2 reports approval prompts for calls their kiro-cli agent auto-approves. On the 0.12 line Crew's gate refuses an
allowedCommandsentry that uses\d,\s,\w,{n,m}or other Rust regex syntax kiro-cli accepts, so its commands prompt (or are refused underdenyByDefault), and aread.allowedPathsgrants nothing. The release batches #33093 and #33229 left these three out for conflicts.Why it matters
Anyone who brings a kiro-cli agent with regex
allowedCommandsor readallowedPathsto Kiro Crew on KAS gets prompts kiro-cli never asks, and a scheduled job using such an agent stalls on the approval. These are approved for 0.12.x by Ray.Not a goal
main; nothing is changed only here.tools_settings_aliases, fix(agents): name toolsSettings aliases as the spec wrote them #32649): too wide for a hotfix, as the earlier partial backport21b747dcdefalready noted. Alias spellings (executeBash,fsRead, ...) keep release's current reading.CHANGELOG.mdchange.What changed (motivation → approach → change)
Each main squash commit was cherry-picked with
-xontorelease/0.12.0@a7a6dd4397, in main merge order, one commit each. The repository's leak guard requires the public identity, so every commit is authored as Ray Xu and names its original author on anOriginal author:line; co-author trailers use noreply addresses.\d \s \wand{n,m}in allowedCommands; add trustedAgents allows after every denyb8b90c433728cbd704f0d170e6347dbcfac32a66ddb535e1876f4b80ac32Prerequisites. All three conflict because
release/0.12.0lacks kiro-cli alias folding (platform/tools_settings_aliases.py,canonical_tools_settings,as_authored) andtrusted_agents_withheld, which come from #30193 and #32649. Picking #30193 was tried first: it conflicts again inkas_agents.py,kas_permissions.pyandkas_skill_scope.py, and it changes behaviour beyond these fixes (16 files, +596). That chain is too wide for a hotfix, so no prerequisite is picked and the hunks below are hand-resolved. They read the rawtoolsSettingskeys where main reads the alias-folded view.Hand-resolved hunks (each commit message lists its own):
acp/kas_permissions.pyweb_fetch branch: comment-only conflict, kept the release text.agent_sdk/kas_tool_view.pytools_settings_unenforced: main's\d \s \w"inexact" naming, read over the rawexecute_bash/shellkeys, withoutcanonical_tools_settings/as_authored.docs/agent-spec-fields.mdtoolsSettingsrow: main's two syntax edits applied to the release text.test/test_kas_tools_settings_aliases.py: not on release, dropped. The ASCII-class naming is covered on release bytest_mate_spec_policy.py.acp/kas_agents.pyimports: addedCREW_ANSWERED_READ_PATHS_KEYonly;CREW_ANSWERED_WRITES_KEYis main-only.acp/kas_agents.pyspec_keys_without_carrier: main'sfs_write/fs_readloop, naming the key as written.docs/agent-spec-fields.mdtoolsSettingsrow: main'sread.allowedPathssentence andgrep/globwording.test/test_kas_tools_settings_grants.py: dropped thefsReadalias case oftest_a_read_inside_allowed_paths_is_answered_by_the_grant; that alias is read only with fix(kas): read kiro-cli toolsSettings aliases, wide path denies and pwsh process control #30193's folding.acp/kas_agents.pyspec_keys_without_carrier: main'sauthored/name_unreadable_entries/projection_dropped_ruleslines, keys named as written, without thetrusted_agents_withheldline.acp/kas_permissions.py: main's move of_agent_glob/_available_agents_rulesintokas_subagent_rules; the import no longer re-exportstrusted_agents_withheld.acp/kas_subagent_rules.py(new): withouttrusted_agents_withheldand itstools_settings_aliasesimport; the two moved helpers are identical to release's.acp/kas_unread_commands.py(new): docstring no longer citescanonical_tools_settings.agent_sdk/kas_tool_view.py: main'sascii_onlydocstring without the alias sentences;unreadable_allowed_commandsreads the rawtoolsSettings.docs/agent-spec-fields.md: main'sallowedCommandssentence andpermissions.rules[<i>]wording on the release rows (word-for-word the same edit as main).test/test_kas_tools_settings_aliases.py: not on release, dropped.Routed to @bolichen97 for the hand-resolved hunks.
Backwards compatibility
Compatible: each fix keeps its main PR's compatibility notes; on release the gate now reads more
allowedCommandssyntax and one more grant (read.allowedPaths), and nothing it read before is read differently.Removes nothing: the subagent helpers move between modules with the same names and are still imported from
kas_permissions; no stored data or config changes.Tests
Proof: not provable -- other: a backport of main commits whose proofs ran on their own PRs
release/*, so the related set ran here, one pytest process at a time with no xdist.test_kas_*,test_agent_spec*,test_tools_settings*,test_doctor*,test_gate_tier*,test_allowed_commands*,test_mate_spec*andtest_side_readonly*file (135 files), in batches of 20: 4,954 passed, 2 skipped, 0 failed.--target-version py310) pass on the changed Python files; mypy passes on the hand-resolved modules.scripts/check_file_line_cap.py:acp/kas_agents.pyis 2,044 lines (2,017 onrelease/0.12.0already, which already fails this check with 5 other files). Not split in a hotfix.Manual verification
N/A - each fix was verified on its own main PR. The 0.12.x RC soak is the end-to-end check.
Related Issues
Backport to the 0.12 line of #31892, #33045 (closes #33041 on main) and #33478.
Sibling sweep
Siblings: none -- each source PR carried its own sibling sweep; this PR only carries those fixes.
Pattern harvest
Not generalizable: this PR only carries fixes already on
main. The source PRs have their own harvest.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.