Repository navigation
fix(kas): read kiro-cli shell spellings when lifting denyByDefault - #32282
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: a fix at mechanism level that reuses the existing What this change shipsInventory (3 items) — 3 justifiedIntent: a KAS agent whose
[FIRST-PRINCIPLES-REVIEWED] f97f336 Description read[DESCRIPTION-READ] 0cd0e7248cd4a711f3522348b9b36f3d060e3214ac3d3375c47f359ff1e0a7b4 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix folds entries through the projection's existing [DESIGN-REVIEWED] f97f336 Description read[DESCRIPTION-READ] 087e5fd4ab31c9ad2feb7c260bc92d022e43942454f2f16db005945e5e04615e 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 |
A spec whose allowedTools names the shell lifts toolsSettings denyByDefault, as kiro-cli does. allowed_tools_grant_shell compared the raw entry against execute_bash and shell only, so executeCmd, execute_cmd and @builtin/execute_cmd, all spellings kiro-cli accepts and the projection already folds, kept an empty allowlist: every shell call of that agent, pwd included, was refused. Fold each entry through canonical_kiro_cli_tool_name before comparing. Wildcard entries still grant nothing. (cherry picked from commit 5a76edf) Backport of #32282 from main. One hunk resolved by hand: the kas_permissions.py import block keeps this branch's imports and adds canonical_kiro_cli_tool_name; main's tools_settings_aliases import belongs to work this branch does not carry.
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: |
A spec whose allowedTools names the shell lifts toolsSettings denyByDefault, as kiro-cli does. allowed_tools_grant_shell compared the raw entry against execute_bash and shell only, so executeCmd, execute_cmd and @builtin/execute_cmd, all spellings kiro-cli accepts and the projection already folds, kept an empty allowlist: every shell call of that agent, pwd included, was refused. Fold each entry through canonical_kiro_cli_tool_name before comparing. Wildcard entries still grant nothing.
5a76edf to
f97f336
Compare
A spec whose allowedTools names the shell lifts toolsSettings denyByDefault, as kiro-cli does. allowed_tools_grant_shell compared the raw entry against execute_bash and shell only, so executeCmd, execute_cmd and @builtin/execute_cmd, all spellings kiro-cli accepts and the projection already folds, kept an empty allowlist: every shell call of that agent, pwd included, was refused. Fold each entry through canonical_kiro_cli_tool_name before comparing. Wildcard entries still grant nothing. (cherry picked from commit f97f336) Backport of #32282 from main. One hunk resolved by hand: the kas_permissions.py import block keeps this branch's imports and adds canonical_kiro_cli_tool_name; main's tools_settings_aliases import belongs to work this branch does not carry.
|
span=be34f8190a37
|
|
span=a7cb148677e1
|
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed at f97f336. Thank you: allowed_tools_grant_shell now folds each allowedTools entry through the existing canonical_kiro_cli_tool_name, so the shell spellings kiro-cli itself accepts (bare executeCmd and execute_cmd, and @builtin/execute_cmd) lift denyByDefault the same way execute_bash does. Spellings kiro-cli does not accept (@builtin/executeCmd, a doubled prefix, glob characters, a non-list value) still grant nothing, and both sides are pinned by the tests. This only stops refusing names kiro-cli already treats as the shell, so it adds no restriction, and it uses exact name folding rather than any pattern matching.
Gates at this head: all 97 checks pass with none red or pending, there is no regex in product code, and no change request is open. Approving; the auto-merge you set stays as it is.
A spec whose allowedTools names the shell lifts toolsSettings denyByDefault, as kiro-cli does. allowed_tools_grant_shell compared the raw entry against execute_bash and shell only, so executeCmd, execute_cmd and @builtin/execute_cmd, all spellings kiro-cli accepts and the projection already folds, kept an empty allowlist: every shell call of that agent, pwd included, was refused. Fold each entry through canonical_kiro_cli_tool_name before comparing. Wildcard entries still grant nothing. (cherry picked from commit f97f336) Backport of #32282 from main. One hunk resolved by hand: the kas_permissions.py import block keeps this branch's imports and adds canonical_kiro_cli_tool_name; main's tools_settings_aliases import belongs to work this branch does not carry.
Problem / Motivation
Goal: A KAS agent whose
allowedToolsnames the shell asexecuteCmd,execute_cmdor@builtin/execute_cmdruns its shell commands like one that writesexecute_bash, instead of having every command refused underdenyByDefault.A spec with
tools: ["executeCmd"],allowedTools: ["executeCmd"]andtoolsSettings.shell.denyByDefault: true(noallowedCommands) should behave as kiro-cli does: naming the shell inallowedToolsliftsdenyByDefault. On KAS it recorded an emptyspec-shell-allowlist, so ordinary commands such aspwdwere refused. Theexecute_bashspelling worked. Found by the GPT review on the 0.12.1 backport #32202.Why it matters
Every shell command of such an agent is refused outright, including in scheduled jobs, for a spec kiro-cli runs as written.
executeCmdandexecute_cmdare spellings kiro-cli accepts and Crew's projection already folds everywhere else.Not a goal
*,e*,execute_*) are read here: they still grant nothing, astest_an_agent_whose_allowed_tools_does_not_name_the_shell_is_still_refusedpins.deniedCommandscarriage (shell_denies_carried) or to the allowlist patterns.What changed (motivation → approach → change)
to_client_custom_agentfoldsallowedToolsthroughexpand_kiro_cli_allowed_toolsfor every other reader, butspec_shell_allowlistgets the raw list andallowed_tools_grant_shellcompared each entry againstexecute_bashandshellexactly.allowed_tools_grant_shellnow folds each entry (after the@builtin/prefix) throughcanonical_kiro_cli_tool_name, the same table the projection uses, before comparing. The fix sits in the shared check rather than at the call site, so wildcard entries keep their fail-closed reading (the expanded list would turn*into the shell name). The comment on_SHELL_TOOL_NAMESandsecurity.mdsay so.Backwards compatibility
Compatible: every entry that granted the shell before still does; only the kiro-cli shell spellings are added.
Removes nothing: the change only lets more specs lift
denyByDefault, never fewer.Tests
test_an_agent_whose_allowed_tools_names_the_shell_is_not_refusedgains["executeCmd"],["execute_cmd"]and["@builtin/execute_cmd"]; each fails without the fold.kas_permissionsor namesspec_shell_allowlist/allowed_tools_grant_shell: 2578 passed.Proof: PROVEN test/test_kas_deny_by_default.py::test_an_agent_whose_allowed_tools_names_the_shell_is_not_refused[allowed_tools8], test/test_kas_deny_by_default.py::test_an_agent_whose_allowed_tools_names_the_shell_is_not_refused[allowed_tools9], test/test_kas_deny_by_default.py::test_an_agent_whose_allowed_tools_names_the_shell_is_not_refused[allowed_tools10] (head 5a76edf)
Manual verification
N/A — unit coverage sufficient: the test drives the projection and the gate's
spec-shell-allowlistrow end to end.Related Issues
Source of the finding: #32202 (GPT review on the 0.12.1 backport).
Sibling sweep
Swept: git grep -n "_SHELL_TOOL_NAMES|allowed_tools_grant_shell(" -- src/
Sibling: src/kiro_crew/acp/kas_permissions.py:450 -- changed here --
spec_shell_allowlistcalls the fixed check, its only callerPattern harvest
Rule candidate: review-prompt
Pattern: a raw allowedTools entry compared to a tool name without canonical_kiro_cli_tool_name
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.