Repository navigation
fix(security): read other agent-tool prose fields as text in the deny scan - #23507
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
6f9c5f8 to
c545e11
Compare
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: |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each new row is a prose field on Kiro Crew's own tool surface (8 of 8 sampled tool names grepped in What this change shipsInventory (9 items) — 9 justifiedIntent: let unattended runs schedule jobs, send messages, start workflows or monitors, save lessons and post comments whose text only mentions a denied step, without the deny scan refusing them. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 8ec5bc5 Description read[DESCRIPTION-READ] 17af509cf421ec19ad7a9da87cbfdae8f6c5488d2acecf880ccf6769d97b3e25 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: each exempted field is prose handed to a model or a person, every downstream tool call keeps its own gate, and Notes
[DESIGN-REVIEWED] 8ec5bc5 Description read[DESCRIPTION-READ] 519db6540739d68b9267a03a938b706810a0a7496cfc0c4f29208dff508fcff8 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 |
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: |
|
HOLD (policy: human review required) at c545e11. This PR narrows what the always-on tool-input deny scan reads as a command line. It adds 11 Kiro Crew tool prose fields to I found no defect. A To clear: a maintainer reviews the deny-scan exemptions. — crew-pr-reviewer (r123) |
c545e11 to
470e2f3
Compare
|
First Principles note (item 3, one consumer generalized) on Took the subtraction as suggested. |
|
Design note (future voidable rows need a The First Principles note asked for the one-entry table to be inlined, so the table this note refers to no longer exists; the |
|
Re the HOLD at
New head: |
…ds, in the deny scan
470e2f3 to
8ec5bc5
Compare
|
Rebased once onto main with operator approval (head
|
bolichen97
left a comment
There was a problem hiding this comment.
This PR adds 11 Kiro Crew tool prose fields (cron_add message, send_message/update_message/send_notification text, workflow intent, monitor message, learn_add rule/negative, artifact comment text) to MCP_DOCUMENT_BODY_FIELDS, so the deny scan stops reading them as shell command lines. It follows the pattern from PR #23334 and closes issue #23331.
What I verified:
cron_addkeeps the full scan onmessagewhen the call namesscriptorcommand, and when params are missing (fail closed).kirocrew-cronis the real server name inmcp_cron_tool_list.py.cron_updateand artifactcontentstay scanned. The issue listed both as candidates, and the PR body gives a sound reason to leave each out, matching the issue's own "leave out anything a handler executes".- Exempt fields keep the sensitive-path and size checks, and command fields (
script,command, workflowsource,blocks) keep the full scan. - Duplicate check: no other open or merged PR touches these rows, and main does not have the fix yet. The issue is assigned to the PR author.
- All CI checks and AI lanes are green, and the Design and First Principles notes have dispositions.
No blocking findings. Nice work keeping the exemption table reviewed row by row with each handler cited.
AI-assisted review (Kiro), posted for bolichen.
Problem / Motivation
Goal: An unattended run (cron, Slack, workflow, heartbeat) can schedule a job, send a message, start a workflow or monitor, or save a lesson whose text merely mentions a step a deny rule covers, the same way #23334 made that work for sub-agent briefs.
The always-on tool-input deny scan reads every text field of a Kiro Crew tool call as a shell command line. After #23334 that is fixed for the spawn tools, but a
cron_addwhose agent prompt says "if the tree is broken, the usual recovery is a hard reset; ask first", or asend_messagethat quotes such a step to a person, is still refused on an unattended surface, while the dashboard accepts the same call.Why it matters
Scheduled and channel-driven agents routinely write prose about git and shell steps into job prompts, notifications and lessons. Refusing those calls breaks the job with nothing actually run, and the user sees a refusal for text that was never going to execute.
Not a goal
command,cmd,script, workflowsource).content,cron_update, script-jobmessage).What changed (motivation → approach → change)
The scan already has a reviewed allowlist,
MCP_DOCUMENT_BODY_FIELDSinsrc/kiro_crew/platform/tool_paths.py, of fields on Kiro Crew's own servers that are text, not commands. Listed fields skip the command-text rules but keep the sensitive-path check and the size ceiling. This PR adds the remaining prose fields, each checked against its handler:cron_add(kirocrew-cron)message(the scheduled agent's prompt)script,command, the restsend_message/update_message/send_notificationtext,title,bodyblocks,url, routingworkflow_run/workflow_authorintentsource,input,argsmonitor_start/monitor_updatemessagebanner,target, the restlearn_addrule,negativecategory,repo_scopeartifact_post_comment/artifact_reply_commenttextslug,parent_idA script cron job reads
messageas its arguments, somcp_document_body_keysinsrc/kiro_crew/platform/tool_paths.pyturns the exemption off for anycron_addcall that namesscriptorcommand(one inline condition, no separate table); with no params passed the exemption is off too. A later row whose field stops being prose when another argument is present must add its condition there in the same change.cron_updateand artifactcontentstay unlisted.llm_helpers_parts/tool_approval.pypasses the call's params to the lookup. The security spec (docs/system-specs/modules/security.md) lists the new fields and the exclusions. A refusal still names the rule that matched (from #23334).Backwards compatibility
Compatible: the change only stops refusing listed prose fields on trusted Kiro Crew tool identities; every call accepted today is still accepted, and
mcp_document_body_keysgains an optionalparamsargument.Removes nothing: no field, key, rule or public function is removed; the scan covers strictly fewer prose strings and the same command strings.
Tests
test/test_llm_helpers_spawn_brief_scan.pygains, for each of the 14 tool fields:Plus: a
cron_addnamingscriptorcommandkeepsmessagescanned, a command job running the step is refused, the lookup fails closed without params,cron_updateis unlisted, a credential path in a prose field is still refused, and artifactcontentis still scanned.test/test_llm_helpers_mcp_document_body.pypins the full table.30 new tests fail on #23334's code; all 112 in both files pass with the change, across 5 repeats, reversed order and
-n 4.Manual verification
N/A — the gate is a pure function of the permission event; unit tests drive the real
_resolve_permissionand audit row.Related Issues
Closes #23331
Sibling sweep
Swept: every
"name":tool entry insrc/kiro_crew/mcp_tools/,src/kiro_crew/mcp_cron_tool_list.pyandsrc/kiro_crew/mcp_work.py, reading each string field's handler.Sibling: src/kiro_crew/mcp_tools/artifacts.py -- not affected -- artifact
contentcan be deployable webapp code, so it stays scannedSibling: src/kiro_crew/mcp_cron_tool_list.py -- not affected --
cron_updatecan retarget an existing script job whose kind the gate cannot seeSibling: src/kiro_crew/mcp_tools/control_parts/schemas.py -- not affected --
task_runspecstays scanned because it can name a spec file pathPattern harvest
Rule candidate: review-prompt
Pattern: "a new MCP tool string field that is only stored or handed to a model must be added to MCP_DOCUMENT_BODY_FIELDS with its handler cited, or it is read as a command line by the deny scan"
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)