Repository navigation
Conversation
…ion's tools The broker now checks design step (6) check 7: each gateway call's exact server and tool must be inside the acting agent's effective ceiling. - The definition loader resolves each definition's ceiling against the servers the gateway routes. A server the definition's mcpServers references is granted whole, minus the tools its disallowedTools names; tools selects no MCP tools, as in the harness. Built-ins name every routed server. No tool list is needed, since listing tools needs a user's grant. - Registration stores each instance's effective ceiling: its definition's, narrowed by its parent's effective ceiling, computed once and never widened. - Check 7 runs after the gateway route check and refuses with PERMISSION_DENIED, recording the ceiling it checked. A call whose tool is not named for its server is now an invalid request, and gateway server names are limited to letters, digits, and single underscores, so "<server>.<tool>" and "mcp__<server>__<tool>" each name one server. - A helper that runs a named definition, as a subagent or team member, now gets the session's gateway tools for the servers its definition references, minus excluded tools, removing #2555's shortcut. A test checks the harness and the broker resolve each definition the same way. Records the resolution rule in mcp-authorization.md and updates the identity broker row in the mecak8s operator docs. Closes #2842. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ChrisJBurns
left a comment
There was a problem hiding this comment.
Review against the agent identity design and #2842 / #2851. This lists only issues, gaps, and questions. Nothing here blocks the PR, and none of the correctness items is an authorization bypass; they all fail closed. Please address each one or reply with your reasoning.
Design and ticket gaps
- The ceiling resolves against the wrong server list (major). The #2842 decision, and this PR's edit to
mcp-authorization.md("Definition-derived ceiling"), say the loader resolves against the operator's MCP configuration (mcp.servers). The code resolves againstcfg.IdentityBrokerGatewayServers(internal/app/identitybroker.go:489), which is a test seam that production leaves nil (internal/app/build.go:996). Either change the code, or say in the doc that this list stands in until #2533. - The harness and the broker read different server lists (major).
defGatewayToolsfilters the MCP broker's routed backends (cfg.helperTools); the broker uses the list in point 1. Nothing keeps the two equal.TestDefGatewayToolsAgreesWithTheBrokersCeilinggives both sides the same list, so it can't catch a mismatch. - Resolution inputs aren't kept, so a restart can widen a ceiling (major). The design requires keeping the resolution inputs, and says restoration never recomputes or widens a ceiling (the "Process restart" row in the
agent-definitions.mdcontinuity table, andimplementation.md"Cedar authorization…" bullet 3). The gateway server set is a hidden input: it isn't inDefinitionRef, the revision, or the provenance. Broker state is in memory, so after a restart the instance registers again and its ceiling is recomputed (agents.go:156). A longer server list then gives more authority under the same definition revision. "Never recomputed or widened" holds only within one process, and no shortcut marker records the gap. - #2842's "Done when" items aren't met (major):
- The cross-check against the harness's delegated-authority intersection (
implementation.md"Cedar authorization…" bullet 3). The new test compares one definition's resolution only. It never compares parent-narrowed effective ceilings with what the harness gives a child. Built-ins aren't compared either:builtinCeiling(loader.go:357) versusreadOnlyExplorerCatalog/writableExplorerCatalog. - Backfill. The "Authority work switched on" row and #2842 require live instances to be backfilled and marked. The PR argues none exist, but changes neither the row nor the ticket. Please record the exception, e.g. "not applicable while broker state is in memory; revisit with #2559".
- The cross-check against the harness's delegated-authority intersection (
- The #2842 decision has no sign-off (question). The decision on #2842 is a proposed comment, and the issue asks for review by the design's author. No sign-off is recorded, but the PR treats it as decided.
- The decision text and the code disagree (minor):
- The decision says nothing has to parse
mcp__<server>__<tool>, butresolveCeilingparses it (loader.go:383), and the server-name restriction exists because of that. - The sentence before the new paragraph in
mcp-authorization.mdstill says "permitted server/tool pairs". So doesimplementation.md"Work breakdown" (~line 367). Granting a whole server, including tools it adds later, is a widening that the pair wording doesn't allow. Reconcile both places.
- The decision says nothing has to parse
- Built-ins get every routed server (minor).
builtinCeilingignores itsdef, but #2842's scope says built-ins get their limit from their built-in fields. If a built-in later setsmcpServersordisallowedTools, the broker ignores them without saying so. - Tool naming is now part of the broker's contract (minor).
ValidatereturnsINVALID_ARGUMENTfor anytools/calltool not named<server>.<tool>(service.go:474). That ties broker validation to the embedded vMCP's naming.Gateway.Routereturns(server, tool)in no fixed format, so an external gateway (#2812) that names tools differently would fail every call. The step (6) failure table incredentials-and-lifecycle.mdhas no row for thisINVALID_ARGUMENT. - Listings aren't limited in practice (minor). Nothing in production reaches the
tools/listbranch of check 7 (ceiling.go:132):ListToolsuses the session's credential (mcpbroker/gateway.go:72) and never callsAuthorizeCall. Excluded tool names and descriptions are still listed. The design's "Tool discovery" paragraph wasn't updated either way. - Ticket accuracy (minor):
- The shortcut at
internal/app/agentdefs.go:604says it's "removed by #2548", but #2548's "Removes shortcut" list doesn't include it. Add it there. - "Cedar replaces only
checkCeiling's body" understates #2849. Cedar also needs per-definition policy generation and a policy-based intersection, so the exportedCeilingtype,intersect, andDefinitionRecord.Ceilingchange too.
- The shortcut at
- Branch hygiene (minor):
- #2939 is now merged. This branch still has the
defDisallowsToolloop that #2939 removed, next to the newregisterHelperToolscall, so a rebase will conflict or duplicate it. The PR body still describes #2939 as pending. - "Closes #2842" doesn't link while the base is
feat/run-delegations(closingIssuesReferencesis empty). Check that the link appears after retargeting tomain.
- #2939 is now merged. This branch still has the
- Operator docs (minor). In
user-docs/operating/mecak8s/identity-and-client-access.md, theidentityBroker.enabledrow has two problems:- "the tools of each server its
mcpServerslists" is inaccurate. Only a server named by reference and routed by the gateway counts; inline entries grant nothing. The doc doesn't give the excluded-tool formmcp__<server>__<tool>, or say thattoolsselects no MCP tools (tools: [Read]plusmcpServers: [github]still gets every GitHub tool). - It describes a refusal that production can't reach yet, because no gateway is configured (#2533). Add a qualifier or link.
- "the tools of each server its
Correctness
- The harness and the broker name servers differently (minor).
GatewayServer()returnsroute.backend(internal/adapter/mcpbroker/runtime.go:660), while check 7 uses the server nameGateway.Route()returns. These agree only becauseembeddedGateway.Routepasses the backend name through unchanged. An external gateway that maps names differently would split the harness from the broker without any error. The doc comment onGatewayServer()is wrong as written. - Check 7 depends on the reported
DefinitionRef(minor). Because of the #2551 shortcut, a root can register assystem/mainand get every server. A child that registers as a built-in gets its parent's whole ceiling instead of its own narrower one. Please note this in the check 7 shortcut comment. - Whitespace in excluded tool names (minor).
NewCeilingtrims whitespace around excluded tool names (ceiling.go:36), butdefDisallowsToolmatches exactly. Formcp__github__ merge, the broker excludes the tool and the harness doesn't. The broker is the stricter side, but the agreement test doesn't cover it. - The ceiling string is ambiguous (minor).
Ceiling.String(ceiling.go:109) escapes nothing. Exclusions come from definition files, so a,, a;, or " except " makes the canonical form recorded inDecisionRecord.Ceilingambiguous. - Nits:
isGatewayServerName's doc says the rule rules out prefix clashes, but leading and trailing underscores still allow them:gitandgit_both producemcp__git___x.- The full ceiling string goes into every decision record and every refusal sent to the caller. It has no size limit, and it shows the child its parent's exclusion list.
effectiveCeilingLockedruns on every re-registration, and the result is discarded (agents.go:148).
Missing tests
- No end-to-end test reaches a check 7 refusal. The harness drops the tool first, so #2851's "refused before any token is issued" is proven only by core unit tests.
- The agreement test (
internal/app/defgatewaytools_test.go:83-91) re-implements the broker's allow logic instead of callingCeiling.allows/checkCeiling. Both sides also go throughagentdef.Parse, despite the comment about "their own parsers". - No cases for:
- tools containing
.or__, throughValidate, the ceiling, and the loader; - mixed-case names;
- an integration case where the child's definition grants a server its parent lacks (only the property test covers this).
- tools containing
- A gateway call is refused unless the gateway routes it to the tool's own backend, so the harness and the broker always mean the same server. - Ceilings match tool names exactly, as the harness does; records quote names holding a separator; a refusal no longer shows the ceiling. - A built-in definition that sets tool fields fails to load instead of having them ignored. - An effective ceiling is computed only for a new instance. - Shortcut markers for restart recomputation (#2563) and reported definitions (#2551). - The agreement test uses the broker's own check and covers built-ins and the main agent as parent; new cases for dotted, mixed-case, and ambiguous names, and a child under an empty ceiling. - Docs: the server list the limit resolves against until #2533, whole-server entries, no backfill while state is in memory, the tool-naming refusal, unlimited listings until #2729, and the operator row's accuracy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in main, whose identity broker refuses a workspace on the process's filesystem (#2875). Named definitions run only in sessions with a workspace, so the named-subagent end-to-end test runs on the Redis filesystem, and the named team member, which needs teams and so Kubernetes execution, is tested through the member factory instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A team member without a filesystem skipped its agent definition entirely, so it got every server-global MCP tool and every gateway tool, including ones its definition excludes, and registered with the identity broker as the built-in member, so the broker allowed them too. With the broker on, file-less is the only setup outside Kubernetes execution (#2875). A file-less member that names a definition now gets the file-less core tools its definition does not exclude, its definition's own MCP servers instead of the server-global ones and CallMcpWithQuery, and its servers' gateway tools, and reports the definition, so the broker checks the same limit. The rest of the definition stays file-oriented and is not applied. The named team member end-to-end test runs again, file-less. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, this was thorough. Point by point; fixes are in 29b94ce, plus aa312f5 for a related gap described at the end. Design and ticket gaps
Correctness
Missing tests
Also changed since
|
Closes #2842. Part of #2851. Stacked on #2930: review only the last commit; this retargets to
mainonce #2930 merges.With the identity broker on, each gateway call must now be inside the acting agent's tool limit: its definition's, narrowed by the limit of the agent that started it. Before this, the broker accepted any tool. It implements the decision posted on #2842: resolve each definition's limit against the gateway's servers, with no tool lists.
What changes
Identity broker (
internal/identitybroker)Ceiling, a new value type: the servers an agent may call, each with the tools on it the agent may not. The zero value allows nothing.DefinitionRecordcarries one.mcpServersreferences is granted whole, minus the toolsdisallowedToolsnames asmcp__<server>__<tool>;toolsselects no MCP tools in the harness, so it grants none;AuthorizeCallrefuses a call outside the effective ceiling withPERMISSION_DENIED. It runs after the gateway route check (check 6) and before any ID-JAG exchange. Each decision record names the ceiling it checked. A listing is allowed for any server the ceiling grants.tools/callmust name its tool<server>.<tool>; any other name is nowINVALID_ARGUMENT, so check 7 always sees a tool of the call's server.mecak8s
CallMcpWithQuery, and its servers' gateway tools. It also reports the definition, so the broker applies the same limit. Before, it skipped the definition and registered assystem/member.Docs
mcp-authorization.md("Definition-derived ceiling") records the resolution rule.identityBroker.enabledrow in the mecak8s operator docs now describes the named-helper behavior and the limit.Decisions to review
checkCeiling's body. Splitting<server>.<tool>moved into request validation.defGatewayTools) rather than reading the broker's record, marked as a shortcut removed by Sessions run and register the exact definition revision #2548. A test runs one table of definitions through both and fails if they disagree.Shortcuts
Found, not in this PR
Subagenttool, so its main agent can't call the gateway or start helpers. That already happens before this PR and isn't the helper shortcut Per-agent tool limit, checked by the broker #2842 removes. Filed as Sessions started with a named agent definition get their servers' gateway tools #2938.disallowedTools. Fixed separately in fix(app): keep a team member's MCP tools within its definition's exclusions #2939, now merged and included here.API compatibility
Assessment: no wire change. No proto, gRPC, or HTTP surface changes.
Ceiling,DefinitionRecord.Ceiling,CeilingServer,DecisionRecord.Ceiling, and the stricterAuthorizeCallRequest.Validateare in-process Go API in internal packages. #2559 (broker over gRPC) hasn't landed.Behavior: with the broker on and a gateway configured, a call outside the agent's limit is refused. Production configures no identity broker gateway yet (#2533), so no deployment sees a difference today.
No major bump, no feature identifier, no approval needed.
Testing
Broker:
ceiling_internal_test.go:ceiling_test.go, throughAuthorizeCall:INVALID_ARGUMENT.loader_test.go: resolution against the routed servers, including an inline server, an unrouted reference,toolsnaming a routed server's tool, exclusions, built-ins, and no servers.Harness and broker agree:
internal/appTestDefGatewayToolsAgreesWithTheBrokersCeilingruns one table of definitions through both parsers and both rules.End to end (
cmd/mecak8s, real AS-1, AS-2, and the embedded vMCP):internal/app: a named team member with a filesystem, through the real member factory, gets its servers' gateway tools and never runs the excluded one; a file-less named member keeps to its definition's tools and reports the definition, while a generic one keeps the whole file-less surface.Mutation checks. Each was applied, a test failed, and the code was restored:
Dropping the harness catalog's exclusion alone is not caught. The engine's capability set excludes the tool too, so that mutant behaves the same.
Gates:
task lintandtask docspass.go test -race:internal/identitybroker/...,internal/adapter/mcpbroker,internal/adapter/server,internal/agentcredential/...,cmd/mecak8s, andinternal/app.Real use, local: I rebuilt
mecak8sand ran it with the broker on. A subagent and a Team-tool team, whose second member runs a named definition, registered and reported their delegations with no broker warnings. The binary has no flag that turns on a gateway, so the gateway path is proven by the end-to-end tests above.Panel review (spec, standards, tests, security, architecture, duplication, reuse) found no blockers. I fixed:
tools, and team-exclusion tests;<server>.<tool>inside the policy check;After review
The review's findings and my answers are in the review reply. Two agents also checked each finding against the design independently. Changes from it:
Sign-off on the resolution rule is requested on #2842.
🤖 Generated with Claude Code