Repository navigation
Description
Depends on: none open. No ToolHive dependency: registering this validator in hosted AS-1 is #2654, which waits on stacklok/toolhive#6899 and stacklok/toolhive#6898. It does not depend on #2677: its tests open sessions without AS-1.
Identity broker code only. It is built and tested against the identity broker; the harness's AS-1 calls it once #2535 adds ID-JAG issuance there. #2654 registers it in hosted AS-1.
Problem
Before issuing a grant, AS-1 must confirm the agent credential is genuine, that the agent's session belongs to the grant's user, and which ag_ identifier names the agent. AS-1 cannot do this itself (step (7), "How AS-1 runs check 6"): for client mecatl it calls a pluggable actor-token validator (stacklok/toolhive#6899), and Mecatl's validator runs in the identity broker. The broker's CredentialVerifier takes a broker session, which AS-1 does not have.
Design
- credentials-and-lifecycle.md: (7) ID-JAG from AS-1
- credentials-and-lifecycle.md: (4) Agent-instance JWT-SVID
- credentials-and-lifecycle.md: (6) Per-operation authorization
- mcp-authorization.md: Authentication and execution context
- implementation.md: ToolHive work list
Requirements
Per credentials-and-lifecycle.md step (7), "How AS-1 runs check 6", and step (4)'s SVID checks (inputs, check 8 at AS-1, outputs):
-
Checks: SVID checks 1–7, then check 8 at AS-1: the instance's present broker session is open, is owned by the given owner, and the credential was issued since the instance moved to that session, so a credential from before a close does not verify after the instance re-registers into the replacement session. "Registered to the call's broker session" is not AS-1's check; it stays at the broker's step (6), which Per-call grant and gateway token #2535 calls.
-
Owner: the form takes an
identitybroker.Ownerand compares it with the session'sOwner, the owner registrations are checked against. (When AS-1 has converted a token for the session, its verified owner equals it.) Turning AS-1'ssub_id(RFC 9493 JSON,iss_subonly) into anOwneris Register Mecatl's actor-token validator at hosted AS-1 #2654's, using the same rule as session open; an invalidOwnerisdenied. -
Output on allow: the agent's
ag_identifier, its SPIFFE ID, and the credential'sexp. -
Refusals: only
svid_expiredfor an expired credential anddeniedfor everything else, including a malformed request, a closed broker session, and an agent whose session belongs to another user.session_closedis reported only by the broker, from its own records, never through this form. -
Validator failure: any other error (internal, or an unavailable store once records persist) means the validator could not answer. That is a retryable infrastructure failure at AS-1, with nothing revoked (step (7)'s failure table); AS-1's mapping is Register Mecatl's actor-token validator at hosted AS-1 #2654's.
-
Access: two forms of the identity broker's credential verification on
identitybroker.CredentialVerifier, apart fromCore:- an owner-keyed form for AS-1's validator, as above;
- the existing session-keyed form (
VerifyCredentialwith a broker session ID), kept for the broker's step (6).
Today
VerifyCredentialRequesttakes only a session ID (internal/identitybroker/service.go,boundary.go,agents.go) and returns the closing reason; add the owner-keyed form, and fix the comments that call the session check AS-1's (CredentialVerifier's doc inboundary.go,Broker.VerifyCredential's inagents.go, and the conformance suite's inconformance.goandcredentials.go). AS-1's wiring takesCredentialVerifieronly, neverCore; here that is only where the method lives, since the wiring is Register Mecatl's actor-token validator at hosted AS-1 #2654's. This is a broker-internal call, not part of the interface Mecatl's session code uses.
Registering the validator at AS-1 (client mecatl only, token type pinned) and the questions for ToolHive are #2654's.
How it fits
Step 3 of the flow: AS-1 can issue a grant naming the user and a registered agent.
Done when
Against the identity broker, with no AS-1:
- The owner-keyed form allows only a valid agent credential whose present session is open and owned by the given owner. It returns the agent's
ag_identifier, its SPIFFE ID, and the credential'sexp. - An untrusted, malformed, wrong-audience, unregistered, or expired credential is refused with the broker's reasons (
svid_expired, otherwisedenied), and so are a credential from another user's session, one whose broker session is closed, and an invalid owner. - A credential issued before the instance's session closed is
deniedafter the instance re-registers into the replacement session; the credential issued there passes. - An agent from another session of the same user passes the owner-keyed form; the session-keyed form refuses it.
- Contract tests cover both verifier forms. When Per-agent registration and identities, switched on #2527 has landed, the owner-keyed cases run in both modes and return the instance's own
ag_identifier.
The real AS-1 calling this validator, with grants capped at the credential's expiry, is tested in #2654.
Activity
docs(agent-identity): check 8 at AS-1 also requires the instance's se…
feat(identitybroker): verify an agent credential for a grant's owner