Repository navigation
Description
Depends on: #2559 (workload authentication, RPC contract and transport), #2562 (renewal and key rotation), #2563 (durable broker state), and #2805 (more than one replica); ToolHive: the "to file" row in "Phase 3, Track: ToolHive — The remaining ToolHive changes for audit, sign-out, and schedules" (#2570) for a pluggable signer for the authorization server's keys, "Add audit logging to authserver" (stacklok/toolhive#3919), and the ToolHive set for "[Phase 3] Run mecak8s with the identity broker on more than one replica" (#2805)
Problem
The identity broker, including AS-1, runs as modules inside the mecak8s process (internal/app/identitybroker.go builds it with identitybroker.NewInProcess, and AS-1's token validator uses an in-process HTTP client). A compromised mecak8s can therefore sign an ID-JAG for any user, steal refresh tokens and signing keys, read users' provider tokens in embedded mode, and forge or suppress broker and AS-1 records from then on (threat-model.md: A compromised mecak8s).
Design
- README.md: the broker "later moves, as a whole, into a separate service; the protocol and token formats do not change"
- implementation.md: Modulith constraints
- threat-model.md: What the split requires
- mcp-gateway-modes.md: once the broker is its own service, the embedded gateway is its own deployment
- credentials-and-lifecycle.md: Sign-out and revocation: the revocation event
- agent-definitions.md: the definition loader moves with the broker
Requirements
- One tree, one move. The broker, AS-1, and the definition loader move together into a broker service binary and Helm chart. Protocol and token formats do not change.
- AS-1's issuer and routes. AS-1 keeps its issuer URL byte-identical, so existing approvals that name it as
actor_issstill match. Its public routes (discovery, JWKS, authorize, token) are served by the broker service, and the token validator fetches AS-1's keys over the network instead of the in-process client. - RPC only. mecak8s reaches the broker only over the RPC contract, authenticated as its workload (Broker over gRPC, authenticated as the mecak8s workload #2559). No in-process path remains.
- Revocation event. When AS-1 starts a sign-out or revocation, the broker tells mecak8s through a revocation event, and mecak8s cancels live runs and parked calls.
- Keys. AS-1, the broker client
mecatl, and the agent-instance issuer each have their own key, held in a KMS that only the broker's service account can sign with. mecak8s holds none of them. - Storage. The broker has its own database and credentials, with no joins or shared transactions with mecak8s's session store (Durable broker state and recovery #2563).
- Namespace. The broker runs in its own namespace. mecak8s cannot create pods, read secrets, or change configuration there, and cannot write the broker's workload allowlist, trust bundle, or policy inputs. Executor Pods have no route to the broker's listener, database, or KMS.
- Embedded gateway. In embedded mode, AS-2, its credential store, and the vMCP run as their own deployment with their own storage credentials.
- Audit. Broker and AS-1 records are written by the broker service to an append-only store mecak8s cannot write.
- Migration. An operator moves an existing in-process deployment to the broker service with no change to issuers, client registrations, or open sessions' workload binding.
How it fits
Removes the last phase 1 shortcut and turns the threat model's "Separate broker service" column from design into deployment. Hash-chained records with signed checkpoints (audit.md, "Later") become worth building once this lands.
Done when
A deployment runs the broker as its own service meeting every item in "What the split requires"; mecak8s has no AS-1, broker-client, or agent-issuer key and no broker database credentials; the identity flow (sign-in, session open, gateway call, sign-out) passes end to end against it in Kind; and an in-process deployment migrates to it without users signing in again.
Activity
test(identitybroker): adapt the helper-agent tests to the no-workspac…