Skip to content

feat(identitybroker): issue the gateway's ID-JAGs at the hosted AS-1 - #2856

Merged
ChrisJBurns merged 2 commits into
mainfrom
feat/identitybroker-as1-issues-idjags
Nov 18, 2026
Merged

ChrisJBurns merged 2 commits into
mainfrom
feat/identitybroker-as1-issues-idjags

Conversation

@ChrisJBurns

Copy link
Copy Markdown
Contributor

Third and last PR of #2654: the hosted AS-1 issues the gateway's per-call ID-JAGs, checked by the identity broker's verifier, and the per-call tests move off the harness AS-1. Stacked on #2840.

What

Wiring (internal/app):

  • When the test-only IdentityBrokerGatewayServers is set, the app derives the AS-2 the bundled MCP broker will set up (mcpbroker.AS2Endpoints, from the callback URL, using the same functions AS-2 construction uses) before building the identity broker. The hosted AS-1's delegate client then gets ID-JAG issuance for that target, with act.iss = identitybroker.ActorIssuer(<the broker's trust domain>).
  • Production sets no gateway servers, so it configures no ID-JAG target, no actor profile and no validator, as the Register Mecatl's actor-token validator at hosted AS-1 #2654 shortcut row says (removed by Configure the embedded gateway's authorization server as AS-2 #2533 and Keys and gateway entries for the identity broker #2538).
  • After the broker is built, IdentityBrokerAS1.ActorTokens.UseCredentialVerifier(broker) binds AS-1's actor-token check. A failed bind fails startup. ActorTokens replaces the test-only UseCredentialVerifier hook, so tests with an external real AS-1 bind the same way production does.
  • Startup also fails if the AS-2 the MCP broker sets up isn't the one AS-1 issues ID-JAGs for.

Broker core: identitybroker.ActorIssuer(trustDomain) builds act.iss (spiffe://<trust domain>) in one place; VerifiedAgent.ActorID uses it.

Tests moved to the real AS-1 (as1servertest.Start with IssueIDJAGs, users signed in before the build so AS-2's test trust can name their sub):

  • internal/app gateway tests; act is now {iss: spiffe://<td>, sub: spiffe://<td>/agent/<ag_>}.
  • The mecak8s gateway tests (TestIdentityBrokerGatewayCallAgainstRealAS1, TestIdentityBrokerSessionToolCallThroughGateway): ID-JAGs are observed on the wire (claims, per-call operation, count) instead of through the harness.
  • internal/identitybroker authorize integration tests, authserverclient ID-JAG and AS-2 redemption tests.

New tests:

  • TestIdentityBrokerGatewayCallRenewsAnExpiredCredential (mecak8s): the real AS-1 refuses an expired agent credential with actor_token_expired, the broker renews it, and the call is retried once and reaches the vMCP.
  • TestHostedAS1IssuesTheGatewaysIDJAGs: the hosted AS-1 issues an ID-JAG naming the agent (act, aud, resource, client_id, exp no later than the credential).
  • TestHostedAS1IssuesNoIDJAGsInProduction, TestDeriveGatewayIDJAGTarget, TestBuildFailsWhenAS1sActorTokenCheckCannotBind, TestBuildMCPBrokerRefusesAS2OtherThanTheIDJAGTarget.

Kept on the harness AS-1 (Shortcut, removed by #2568): the two TestAuthorizeCallRevokedRulesAtAS1 subtests that need real revocation reasons, and TestIdentityBrokerAgainstOfflineHarness, which mints another client's token and moves AS-1's clock.

Shortcut

Shortcut Removed by
Through mecak8s, the full gateway chain runs with a real AS-1 the test starts, not the one mecak8s hosts. AS-2's test trust must name the user's AS-1 sub, which the hosted AS-1 creates only at first sign-in. The hosted AS-1 is proved up to ID-JAG issuance. #2533 (AS-2 trusts AS-1 without naming subjects)

Effect on other tickets

Assessed against every open phase 1 and phase 2 ticket. No scope changes; wording only:

#2527, #2741, #2551, #2553 and #2555 change because of #2834's opaque IDs, not this PR.

Checks

  • task lint: 0 issues.
  • go test -race for internal/identitybroker/..., internal/testutil/identityharness/..., internal/adapter/mcpbroker/..., and the identity and gateway tests in internal/app and cmd/mecak8s: pass.
  • Root module (GOWORK=off -mod=readonly -race ./...): every package passes except deploy/helm/mecatl-execution and deploy/mecatl-execution-kind, whose six failing tests fail identically on main in this environment (local Helm and shell tooling).
  • Mutation-checked: the hosted IDJAG wiring, the verifier bind, the production guard, a wrong act.iss, and the new expiry test (no renewal, or actor_token_expired mapped to denied).

Issue relationship

Closes #2654

API compatibility

None: internal packages only, no wire or public API change.

@ChrisJBurns
ChrisJBurns force-pushed the feat/identitybroker-as1-issues-idjags branch from 3dd0c4b to 3d56093 Compare November 18, 2026 15:06
Base automatically changed from feat/identitybroker-as1-actor-validator to main November 18, 2026 15:28
ChrisJBurns and others added 2 commits November 18, 2026 15:29
When the test-only gateway servers are set, the app derives the AS-2 the
bundled MCP broker will set up and gives the hosted AS-1's delegate
client ID-JAG issuance for it, with act.iss the broker's agent trust
domain. After the broker is built, AS-1's actor-token check is bound to
its CredentialVerifier through IdentityBrokerAS1.ActorTokens, which
replaces the test-only hook; a failed bind, or an AS-2 other than the
target, fails startup. Production still configures no target.

The per-call tests move from the harness AS-1 to the real AS-1, and a
mecak8s test shows an expired credential refused by AS-1, renewed, and
the call retried once. Only the revocation-reason tests stay on the
harness, until #2568.

Closes #2654.

Co-authored-by: Mecatl <noreply@mecatl.dev>
The production test now asks the hosted AS-1 whether it issues ID-JAGs,
which a call refused before AS-1 could not show, and derives the target
from the config it builds with. The gateway variant checks the opposite.
The second-bind test fails unless the bind itself refused the build.

Co-authored-by: Mecatl <noreply@mecatl.dev>
@ChrisJBurns
ChrisJBurns force-pushed the feat/identitybroker-as1-issues-idjags branch from c278e0d to 677245e Compare November 18, 2026 15:33
@ChrisJBurns
ChrisJBurns merged commit 9b997c2 into main Nov 18, 2026
50 checks passed
@ChrisJBurns
ChrisJBurns deleted the feat/identitybroker-as1-issues-idjags branch November 18, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register Mecatl's actor-token validator at hosted AS-1

2 participants