Repository navigation
fix(tools): narrow every managed server to its per-tool refs under honourToolRefs - #23322
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
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: |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The PR replaces one hard-coded server name with the managed-server set that the shared dispatcher already enforces by name. Every server in that set imports the shared dispatch, and nothing outside the patch reads the renamed Notes
[DESIGN-REVIEWED] 6962440 Description read[DESCRIPTION-READ] 1d9154f2694fc8f4002c1ee6fe378345003ef51739209655fe261a5fa1ee6d63 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. Linked issue #21610 is the source of the defect. The fix is a change to the gateway's policy answer behind the default-off What this change shipsInventory (5 items) — 4 justifiedIntent: let an operator give a session only some tools of any Kiro Crew managed server (not only
[FIRST-PRINCIPLES-REVIEWED] 6962440 Description read[DESCRIPTION-READ] 267d507cbf04b5bd6d846328e2185c01f821d61b96f73ae04abf18856cdf18f6 That sha256 names the PR description this verdict read. Recompute it with |
41e723e to
b8f587e
Compare
|
CI note for head 41e723e, fixed in b8f587e: |
|
Rebased once onto main for the #23264 Windows fix. |
b8f587e to
62e452e
Compare
|
CI note for 62e452e: Backend Tests (Windows) (1), (3) and (4) fail in |
62e452e to
e5e8095
Compare
e5e8095 to
6962440
Compare
|
Holding for human review. This PR changes what a managed-tool policy allows. One unanswered note on this head: Design Review suggests a pin test that every server in Reviewed head: — crew-pr-reviewer (r131) |
iamwhatever
left a comment
There was a problem hiding this comment.
APPROVE (security-sensitive scope, maintainer-accepted)
This PR tightens a security rule, so it was held for a human decision. A maintainer reviewed the deep check and a separate regression check for this exact head (69624407563a) and accepted it. This approval supersedes the earlier HOLD from crew-pr-reviewer.
Regression check: per-tool narrowing under honourToolRefs now applies to every managed server, but only when a spec opts in and lists per-tool refs for that server. No shipped spec, template, builtin agent or app sets honourToolRefs, and bare @server, * and glob grants still get the whole server.
Tests on this head: test_managed_tool_policy_include.py 49 passed; test_app_mcp_tool_policy_scope.py, test_session_tool_policy_cache.py, test_session_tool_policy_off_loop.py 101 passed; no existing assertion changed.
CI is green on this head, the base is main, and there is no conflict.
— crew-pr-reviewer (r133)
Problem / Motivation
Goal: A spec that grants one of Kiro Crew's managed servers tool by tool, with
managedToolPolicy.honourToolRefs: true, gets only those tools from that server, for every managed server and not onlykirocrew-core.A spec that granted
kirocrew-dashboardthrough@kirocrew-dashboard/<tool>refs got the server's whole tool list in the session. On the kiro backend a managed server's tools arrive through Crew's per-session identity element, which@server/toolrefs do not narrow, anddisabledToolson a managed server withholds that element so every call is refused. ThehonourToolRefsinclude list was the one narrowing that works on that path, and it was only derived forkirocrew-core.Why it matters
An operator who wants a session that may use some dashboard tools but not others had no spelling that both keeps the server usable and withholds the rest, only a prompt rule plus the approval card.
Not a goal
honourToolRefsopt-in; the default answer is unchanged.disabledToolswithholds a managed server's identity element.What changed (motivation → approach → change)
Every managed server already enforces an
includelist keyed by its own name in the shared dispatcher (mcp_shared_dispatch), so the gap was only in the gateway's policy answer._policy_answerindashboard/handlers/sessions_parts/tool_policy.pynow derives anincludeentry for each server inINCLUDE_LIST_SERVERS, which is every Kiro Crew managed server (KIROCREW_BIN_MCP_SERVERS), instead ofkirocrew-corealone. Each server is read on its own, so a whole-server grant on one does not stop another from being narrowed.The spec-field reference (
src/kiro_crew/docs/agent-spec-fields.md) and the MCP architecture doc describe the opt-in for every managed server.Backwards compatibility
Compatible: a spec without
honourToolRefs: true, and an opted-in spec that grants every server whole, answer exactly as before; an opted-in spec'skirocrew-coreentry is unchanged.Reader: src/kiro_crew/dashboard/handlers/sessions.py:INCLUDE_LIST_SERVER -- dashboard facade -- renamed to
INCLUDE_LIST_SERVERS(a tuple); no in-repo reader used the old name, and its facade inventory drops it.Tests
In
test/test_managed_tool_policy_include.py:test_per_tool_refs_to_an_opt_in_managed_server_answer_its_include— per-tool refs tokirocrew-dashboardanswer its include list.test_each_managed_server_is_read_on_its_own— a whole-server grant onkirocrew-corebeside per-tool refs tokirocrew-dashboardnarrows only the dashboard server, and a third-party server is never narrowed.test_every_managed_server_is_eligible— the eligible set is the managed-server set.The existing tests for the server's own
tools/list/tools/callhandling already cover enforcement by server name. Revert proof: restoringINCLUDE_LIST_SERVERStokirocrew-corealone turns the three new tests red.Manual verification
N/A — unit coverage sufficient: the change is the gateway's policy answer, and the dispatcher's enforcement of an include list is already tested per server name.
Related Issues
Closes #21610
Sibling sweep
Swept: git grep -n "per_tool_grants|INCLUDE_LIST_SERVER" -- src/
Sibling: src/kiro_crew/dashboard/handlers/sessions_parts/tool_policy.py -- changed here
Siblings: none --
per_tool_grantshas no other caller, and enforcement already reads the include map per server namePattern harvest
Not generalizable: the defect was one hard-coded server name in a single policy answer.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)