Repository navigation
fix(acp): carry a kirocrew-core disabledTools toggle on the session gate instead of refusing - #17547
chenmingwei23 wants to merge 1 commit into
Conversation
…ate instead of refusing
bolichen97
left a comment
There was a problem hiding this comment.
[P0] kiro backend: a kirocrew-core disabledTools toggle stops being enforced (fail-open)
Class: Security guard turned fail-open (disabled tool runs on the kiro backend).
Mechanism: For control-plane servers the PR sets can_carry=True (session_mcp.py:1838) and skips the disabledTools withholding arm, moving enforcement to spec_denied_tools. That set is checked only on session/request_permission, but kiro-cli auto-approves @kirocrew-core via allowedTools and sends no permission request.
User impact: A kirocrew-core tool the operator switched off in the MCP tab can still run on the kiro backend; only an after-the-fact tripwire notices.
Location: src/kiro_crew/acp/session_mcp.py:1838 @ 2bd77f369e91283ee6a3b68ac9ff8187e0920440
Minimum fix: Carry a disabledTools pair to the gate only where the backend is proven to raise a permission request for it. On the kiro backend keep the old withholding (or remove the carried tools from the effective allowedTools so kiro-cli must prompt).
How to verify: A unit test with kirocrew-core disabledTools=[learn_add] in mcp.json and the default agent spec on the kiro backend: assert kirocrew-core is withheld, or that learn_add is not auto-approved in the spec handed to kiro-cli. Fails on this head.
Exploit details are left out on purpose. They are available to maintainers through the repo's private security reporting.
Independently re-verified on head 2bd77f369e with a focused local reproduction.
| # auto-approved inside codex without asking), so it keeps the old | ||
| # withholding behaviour and the flag stays off for it -- the same split | ||
| # :func:`session_mcp_restricted_servers` draws, for the same reason. | ||
| can_carry = name in CONTROL_PLANE_SERVERS |
There was a problem hiding this comment.
[P0] kiro backend: a kirocrew-core disabledTools toggle stops being enforced (fail-open) — see the review summary for mechanism, fix and test.
|
@bolichen97 Thanks — your point is correct and addressed. The fix carries a Your verification test is included: Superseded by the draft #17859 (against |
|
Superseded by #17859 (against |
Problem / Motivation
Goal: Disabling one
kirocrew-coretool from the dashboard lets the default agent's sessions keep running without that tool, instead of refusing every new session.Disabling a single
kirocrew-coretool in the dashboard's MCP tab writesdisabledToolsinto the globalmcp.json. On the kiro backend the default agent's control plane is mounted as a per-session element, and that element cannot expressdisabledTools(a kiro-cli-only key), so after #14078 every new session of that agent was refused with an error until the toggle was undone. The toggle's apparent promise (lose one tool) and its effect (lose the agent's sessions) diverged.Why it matters
Turning off one tool should cost one tool, not the agent. Until the toggle was undone,
skill_searchand every other control-plane capability were unreachable on that backend, so the default agent could not start a session at all — a surprising, hard-to-diagnose outcome for a routine UI action.Not a goal
disabled: true), a non-stdio transport, or any key a per-session element cannot carry still keeps the declaration native and withholds the element — none has a per-call form a gate could honour.kirocrew-dashboard) are not carried: their tools can be auto-approved by the harness without a permission request, so the per-call gate is not a complete channel for them.What changed (motivation → approach → change)
A
disabledToolstoggle on a control-plane server used to withhold the per-session element, and the runtime refused the session rather than mount an element that silently dropped the restriction. The faithful alternative already exists for mirrored backends: the restriction rides the session's per-call permission gate, where a switched-off tool is rejected at the permission request. Control-plane tools carry no annotations, so every call reaches Crew as a permission request — the gate is a complete channel for them.So for a control-plane server a
disabledToolsrestriction is now carried, not withheld: the element mounts (it only ever carried command/args/env), and the toggled(server, tool)pairs are fed into the session'sspec_denied_tools. The session starts minus the toggled tool and keepsskill_search. The runtime refusal remains the fallback for the restrictions nothing can carry.session_mcp.py: acarry_disabled_toolsflag on_native_restriction/native_mount_withholdingthat turns off only thedisabledToolsarm;NativeControlPlaneMountgains acarriedset andnative_carried_disabled_tools()reads the pairs from the same declarations the withholding predicate reads;kiro_control_plane_serverspasses the flag forCONTROL_PLANE_SERVERSand returns the carried pairs.runtime.py:_unpooled_control_planesreturns the carried pairs, and both the fresh (create_session) and resumed (load_session) kiro paths feed them into the session'sspec_denied_tools.skill_projection.py: adisabledToolstoggle onkirocrew-coreno longer refuses the skill view (theskill_search-disabled refusal above it is unchanged).Backwards compatibility
Compatible: a session that was previously refused now starts with the toggled tool denied at the gate; no session that worked before changes behaviour, and the other withholding arms are untouched.
Removes nothing: no path, record, key, or public function is removed or hidden — the change replaces a refusal with a mounted element plus a per-call deny, and the refusal still stands for the restrictions nothing can carry.
Tests
test/test_native_skill_projection_sources.py:disabledToolstoggle in the global settings, the project settings, or the spec entry now carries on the gate (element mounts,carriedholds the pair) instead of refusing — new/rewritten tests assert the carried pair and the mounted element.skill_search-disabled still withhold / refuse (converted the formerdisabledTools-refuses cases to a mute to keep that coverage).Manual verification
N/A — unit coverage sufficient: the behaviour is exercised end to end through
AcpRuntime._unpooled_control_planesdriving the real mount and the session handle's deny set intest_native_skill_projection_sources.py.Screenshots / video
N/A — no user-visible frontend surface changes; the diff is backend ACP control-plane code under
src/kiro_crew/acp/.Related Issues
Fixes #14125
Pattern harvest
Not generalizable: a backend-specific gap between a native-only restriction key and a per-session element on one server family; the fix reuses the existing per-call deny gate rather than introducing a reusable pattern.
Checklist