Repository navigation
fix(security): keep a verified tool-identity title out of the path tier - #17344
chenmingwei23 wants to merge 1 commit into
Conversation
A permission title such as `@kirocrew-core/wait` is a tool name, but both the `_resolve_permission` title tier and `hooks.on_tool_call` handed it to `sensitive_path_refusal` as a filename. Under resolver load that check stalled and refused the call fail-closed with a "Path:" wording that names no path. Add `title_is_trusted_mcp_identity`: true only when the title is exactly the call's own `@server/tool` (or `@server`) reference built from the provenance-verified `_meta.kiro` identity (`mcp_identity_trusted`), with no separator in either segment. Both sites skip the path tier for that one string. Any other title of an MCP call, an unverified identity, and every argument stay path-gated; the bash and deny-rule tiers still read the title. Fixes kirodotdev#12723
3285b18 to
4efbeb9
Compare
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that a real kiro-cli [DESIGN-REVIEWED] 4efbeb9 Description read[DESCRIPTION-READ] ced6bbeb3b786b32f303715d2271cfb62771e8cb0a22fd8103ba5fdee46cf1ef 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, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The exemption only matches the bare Not justified as shipped
What this change shipsInventory (5 items) — 3 justifiedIntent: stop MCP tool calls being refused as a "sensitive path" when the path resolver stalls. FIX (#12723).
[FIRST-PRINCIPLES-REVIEWED] 4efbeb9 Description read[DESCRIPTION-READ] bb6d1b7f9ee8b99336a6d0919edb221ffe65b70d75f931ce50fa4712c83864c6 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Security Scope Review (fork) — 🟡 CONCERNSWhich legitimate operations does the reviewer's own judgement; no confirmed regression Scope-Verdict: CONCERNS TIGHTENING: Nothing in this change gets stricter. It loosens the tool-gate sensitive-path tier for exactly one string: a permission title that matches the call's own verified MCP identity byte for byte, ADJUDICATED: 11 candidates. I have no verdicts: the harness classifies them at both refs after this review is captured. They are the touched tests run in posix and Windows spellings, identity-string searches, and history and diff reads of the touched modules. Because the diff leaves the shell composite alone, every row should classify the same at base and head. PLATFORM COVERAGE: The rows cover posix and windows. Posix: UNADJUDICATED: The changed guard is the always-enforced path tier on the permission title. It lives at two sites:
The shell-corpus classifier (
One more point I could not confirm, since no verdict exists for it. In [SCOPE-REVIEWED] 4efbeb9Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. |
|
Superseded by #17373 (same commit, re-opened from a same-repo branch so Sensitive Change Review can run). Closing this fork PR. |
Problem / Motivation
Goal: a tool call whose permission title is its own tool name is no longer refused as a "sensitive path" when the path resolver is slow.
On a gateway under path-resolver load, a
waittool call was refused fail-closed withPath: @kirocrew-core/wait. That string is a tool name, not a path. It reached the sensitive-path tier because both the_resolve_permissiontitle tier (llm_helpers._title_denial) andhooks.on_tool_call'ssecurity_targetsloop hand the permission title tosensitive_path_refusalas a filename. When the resolver stalls, that check refuses whatever it was given.Why it matters
Any MCP tool call can be refused at random under load, with a refusal that tells the agent a credential path was involved when none was. The agent then retries, re-spells, or goes looking for a credential that does not exist.
Not a goal
What changed (motivation → approach → change)
@server/tool(a "no separator" test cannot, since every MCP identity contains/). It follows the pattern fix(security): do not hand shell command text to the path tier #11223 used for shell command text: one exact string, identified by the client's own provenance, is spared the resolver. Keying on the verified identity rather than on the title's shape is the fail-safe choice. A path-shaped title can never qualify, because it would have to equal the verified identity byte for byte.title_is_trusted_mcp_identity()inhook_runtime/tool_identity.py. It is true only whenmcp_identity_trustedis set, the server name is non-empty, neither segment holds a separator, and the title equalsmcp_identity_ref(server, tool)ormcp_identity_ref(server, "")._title_denialtakesidentity_exempt, and_resolve_permissioncomputes it from the event's trusted identity.hooks.on_tool_callapplies the same predicate per target. In both places only the path tier is skipped. The bash and deny-rule tiers still read the title.docs/system-specs/modules/security.mdrecords the exemption next to the shell-command one.Backwards compatibility
Compatible: the only behaviour change is that one string, a title equal to the call's own verified MCP identity, is no longer resolved as a path. Every other title, every unverified identity, and every argument are judged exactly as before.
Removes nothing: no key, record, validator or function is removed. The path tier is narrowed for one non-path string only.
Tests
test/test_llm_helpers_tool_input_offload.py::TestToolIdentityTitleLeavesThePathTier:_title_denialwithidentity_exemptnever calls the path tier, and the bash tier still runs;_resolve_permission, a stalled path tier no longer refuses@kirocrew-core/wait;test/test_hooks.py: the same two directions at the hook gate (a verified identity title is not resolved; an unverified identity, a path title or an extra segment still is and is denied).Manual verification
N/A: the defect is a pure decision in the gate, and the unit tests drive both gate entry points with a stalled resolver.
Related Issues
Fixes #12723
Pattern harvest
Not generalizable: the path tier already carries one provenance-keyed exemption (shell command text); this adds the only other non-path string a permission frame's title can be: the call's own identity.
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.