Repository navigation
feat(identitybroker): verify an agent credential for a grant's owner - #2733
Merged
Merged
Conversation
Open
9 of 11 tasks
Add VerifyCredentialForOwner to CredentialVerifier, the check AS-1's actor-token validator makes before issuing an ID-JAG: SVID checks 1-7, then the instance's present broker session is open, owned by the given Owner, and the credential was issued since the instance moved there. It refuses only with svid_expired or denied, so no closing reason reaches AS-1; any other error means the check could not be made. Clarify check 8 at AS-1 in the design: the instance's session must be open, as closing a session already ends its credentials' use. Closes #2534 Co-authored-by: Mecatl <[email protected]>
Give every refusal after the SVID checks one detail text, so AS-1 cannot tell a closed session from another owner's. Drop a scheduled-run claim the design contradicts. Test an invalid owner with an expired credential, so the request check is proven to run first, and move the case-differing owner to the another-owner case. Bring the remaining design passages about check 8 at AS-1 in line with its open-session check: the failure matrix, the AS-1 test bullet, and the notes on an AS-1 outside the broker. Co-authored-by: Mecatl <[email protected]>
ChrisJBurns
force-pushed
the
feat/identitybroker-owner-keyed-verify
branch
from
November 6, 2026 14:24
9809515 to
daff080
Compare
This was referenced Nov 6, 2026
jhrozek
approved these changes
Nov 6, 2026
ChrisJBurns
added a commit
that referenced
this pull request
Nov 6, 2026
- Fail a test that leaves injected faults queued. - Check that a sign-in gets the user it selected, and clear an unused selection when authorization fails. - Test an expired client assertion just past its expiry: AS-1 allows no leeway. - Split the test-only IdentityBrokerAS1 clock into the broker clock and the client-assertion clock, so the real-AS-1 test signs on wall time. - Bound the shared AS-1 client to ten seconds per request. - Keep #2733's VerifyCredentialForOwner row in the hard-expiry table. Co-authored-by: Mecatl <[email protected]>
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2534.
Problem
Before AS-1 issues an ID-JAG naming a user and an agent, it must confirm three things: the agent credential is genuine, the agent's session belongs to the grant's user, and which
ag_identifier names the agent. AS-1 cannot check this itself because it doesn't know Mecatl's agent registry. For clientmecatl, it calls an actor-token validator that runs in the identity broker (credentials-and-lifecycle.md, step (7), "How AS-1 runs check 6").The broker had no check AS-1 could call:
VerifyCredential, is keyed by broker session ID. AS-1 has no session ID; from the grant it has only the user (sub_id).VerifyCredentialreturns the session's closing reason, which only the broker should report. And it refuses an agent from another session of the same user, which is the broker's step (6) check, not AS-1's.CredentialVerifier's doc and the conformance suite called the session-keyed check AS-1's.What
This PR adds the check AS-1 needs: an owner-keyed form of agent-credential verification,
VerifyCredentialForOwner, onidentitybroker.CredentialVerifier. It takes the grant's owner instead of a session, so AS-1 can call it with what it has.CredentialVerifierstays apart fromCore, so no transport serves it. The session-keyedVerifyCredentialstays as it is, for the broker's step (6).The owner-keyed form runs SVID checks 1–7, then check 8 at AS-1, which requires all of:
identitybroker.Owner;It refuses only with
svid_expiredfor an expired credential anddeniedfor anything else, including a malformed request, another user's session, and a closed session; no closing reason reaches AS-1. Any other error means the validator could not answer, which AS-1 treats as retryable. On allow it returns theag_identifier, the SPIFFE ID, and the credential'sexp. Every refusal after the SVID checks carries the same detail text, so even an error passed on whole doesn't tell AS-1 whether the session closed, belongs to someone else, or holds a newer credential.Comments that called the session-keyed check AS-1's are corrected in
boundary.go,agents.go, and the conformance suite.Decisions
These were agreed before implementation. Each is recorded here and in the code's doc comments.
Owner, the one its registrations are checked against, notverifiedOwner. In production the two are equal for every session AS-1 exchanges a refresh token for.identitybroker.Owner. Parsing ToolHive's RFC 9493sub_idJSON (iss_subonly, the same rule as session open) belongs to Register Mecatl's actor-token validator at hosted AS-1 #2654's AS-1 adapter.Design notes
#2726 already put "the instance's session is open" into check 8 at AS-1 on main. This PR brings the remaining passages that describe check 8 into line with it:
credentials-and-lifecycle.mdadds "closed";implementation.md's AS-1 test bullet adds a closed session, answereddenied;exp.What the open check does at runtime: until AS-1 revokes refresh tokens when a session closes (not wired yet), it is what refuses an exchange whose session closed after the broker's step (6). The refusal is
denied, so mapping it back to the closing reason the broker recorded is #2535's job ("Session closed during an exchange"). The check looks at the instance's present session, so a stale exchange for a closed session passes if the instance has already moved to an open replacement with the same owner. Only AS-1's own revocation catches that, as the design's "Does not prove" for check 8 already allows for same-user pairings.Tests
conformance/ownercredentials.go), new cases:denied, notsession_closed, with the same error text as another owner;ag_identifier;deniedbefore the credential would answersvid_expired.TestVerifyCredentialChecksruns checks 1–7 through both forms: kid, alg, signature, audience, lifetime, and unregistered subject.TestSessionHardExpiryClosesTheSessioncovers the owner-keyed form when it is the first lookup after the hard expiry.Local gates:
task lint: the root module and the modules linted beforeenvironment/microvmare clean.environment/microvm/launch_ownership_darwin.go:754reports a gosec G703 finding on macOS; this branch doesn't touch that file.task lintstops at that module, so the modules after it weren't linted locally.task docs:check: passes. The fulltask docsneedsbuf, which isn't installed locally.go run ./cmd/mecademo: shows a tool call, a permission ask and approval, and a result.task test:race: the identity broker packages,identityharness, andcmd/mecak8spass. Other tests fail on this machine with or without this change:cmd/mecated: microVM socket path;cmd/mecatui: TLS key size and workspace snapshot;internal/adapter/server: placement cwd;internal/app: filesystem and git worktree tests.API compatibility
No wire impact.
CredentialVerifieris in-process only and served by no transport.Brokeris its only implementer. No protobuf, mapper, or engine semantics change.Follow-ups (not in this PR)
sub_idintoOwner; map refusals and other errors (any other error becomes 503 orserver_error, with nothing revoked) and send AS-1 the reason code only, never the error text; handle the build order, since AS-1 is built before the broker.