Repository navigation
Description
Problem: "Delegated access: subject mapping at ID-JAG redemption" (#6887) lets a gateway's authorization server (AS-2) find its local user U from an ID-JAG, and approve redemptions implicitly for configured issuers. A gateway that the client's operator does not run needs more than that. Knowing that a source identity is U is not permission: each client needs U's approval before its redemptions get the delegated-access marker ("Add a delegated-access marker that gates credential lookup for approved delegated tokens", #6404).
Mecatl's external gateway ("Phase 3, Slice 5: External gateway — Agents use a gateway Mecatl doesn't run, with no extra login step", stacklok/mecatl#2810) needs this: a pre-approved user's calls succeed with no sign-in beyond AS-1, an unapproved user gets an approval link, and revoking the approval stops new gateway tokens.
Design: Mecatl's external consent link, how AS-2 resolves the user and gateway administrator configuration; ToolHive delegated-access design section 11.
Open questions first (design section 11): where the approval record lives (the authorization server's storage or the embedder's directory), and whether approving an actor issuer is acceptable. An actor issuer covers every agent under one configured ActIssuer, which may span several platforms.
Approval
- Approval record: one row per (gateway, local user, client, actor issuer), plus revoked state. The local user is not copied from the source issuer: on each redemption the server finds it from the ID-JAG's
upstream_subject, through the resolver in "Delegated access: subject resolver and actor policy packages" (Delegated access: subject resolver and actor policy packages #7157). The record is checked at every redemption. Only the client it names can revoke it. Redemption returnsserver_errorwhen the store is unavailable. - Administrator pre-approval, opt-in. The mapping comes from the source issuer's
upstream_subjecton first use, or from a directory sync. For an embedder, a directory sync is its ownResolverimplementation. - Approval link: the redemption returns a pending approval plus an
error_uri. The user opens it and signs in through this server's own login; the screen names the client and the account being linked. On approval, the server compares the identity the user signed in with against the ID-JAG'supstream_subject(a stable claim, never email). A match activates the approval. A mismatch refuses it and discards the pending approval.- There is no client callback,
stateor PKCE, so the flow also works from a CLI or another device. It can reuse the device-verification flow's pending record, sign-in and approve page. - Offer user approval only for source issuers that share this server's company identity provider. For other issuers, refuse with plain
access_deniedand noerror_uri; administrator pre-approval is the only option there. - At approval, the server trusts its own comparison. On later redemptions it trusts the source issuer's
upstream_subject, so a compromised source issuer can name any user who has approved, but no one else. - With open client registration, this enables consent phishing by lookalike clients. Deployments that enable both need "Gate inbound DCR (/oauth/register) behind an initial access token" (Gate inbound DCR (/oauth/register) behind an initial access token #6425), and the screen marks self-registered clients as unverified.
- There is no client callback,
- Resolution through an approval record: the user mapping recorded at approval, as a
Resolverimplementation. - The authorization server advertises the approval-continuation profile in its metadata:
access_deniedwithconsent_requiredinerror_description, and anerror_urinaming a pending approval (draft -06 §4.4.3: the ID-JAG is valid, and remediation is the operator's access-request process). Advertising it tells clients that theerror_uriis a consent link, not a help page. RFC 6749 §5.2 defineserror_urias a page for the client developer, so this profile repurposes it; Mecatl follows it only under the advertised profile, ashttpson this server's issuer origin. fosite'sRFC6749Errorhas noerror_urifield, so the response needs custom serialization. - The "approval missing" reason code from "Authorization server: reason codes in error_description for ID-JAG redemption refusals" (Authorization server: reason codes in error_description for ID-JAG redemption refusals #7030).
- Users can list and revoke their approvals. The consent screen takes display names from the client registration and the trusted-issuer configuration, never from the request.
Tests
- Mecatl's external-gateway end-to-end test ("External gateway fixture and end-to-end test", External gateway fixture and end-to-end test mecatl#2540) against a separately deployed ToolHive gateway in kind: a pre-approved user's calls succeed; an unapproved user gets the approval link and, once approved, later calls succeed; revoking stops new gateway tokens.
- Unit and integration rows for each refusal, with the exact
errorand reason.
Depends on
- "Delegated access: subject mapping at ID-JAG redemption" (Delegated access: subject mapping at ID-JAG redemption #6887).
- "Gate inbound DCR (/oauth/register) behind an initial access token" (Gate inbound DCR (/oauth/register) behind an initial access token #6425), before the approval link ships on a gateway that also allows open client registration.
Related: "Delegated access: tokens and actors from third-party issuers" (#7159) covers clients other than Mecatl.
Activity
ChrisJBurns commentedon Nov 18, 2026
Proposal for the approval record: key it on the source issuer too, so there is one row per (gateway, local user, client, source issuer, actor issuer), plus revoked state.
Why: for Mecatl, the actor issuer is not AS-1. ToolHive refuses an
ActIssuerequal to the server's own issuer, so Mecatl registers its agent trust domain (spiffe://<trust domain>) asActIssuer, and every ID-JAG carries that asact.iss. Trust domain names are not unique across deployments. The client in the key ties an approval to one broker's credentials, but not to one AS-1: if one client is allowed under more than one trusted AS-1, or its key leaks, an ID-JAG from another AS-1 that names the same user and the sameActIssuerwould match. The source issuer (the ID-JAG'siss) ties the approval to one AS-1 and the agents it vouches for, whatever the client registration.This also narrows the open question on approving an actor issuer: with the source issuer in the key, an approval covers one AS-1's agents under that
ActIssuer, not every platform that uses the sameActIssuer.What changes:
iss.isstoo.Mecatl's design keys it this way: how AS-2 resolves the user and credentials-and-lifecycle.md, step (8), check 9.
Add reason codes to redemption refusals