Skip to content

Delegated access: user approval at an external gateway #7158

Open

Description

@jhrozek

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 returns server_error when the store is unavailable.
  • Administrator pre-approval, opt-in. The mapping comes from the source issuer's upstream_subject on first use, or from a directory sync. For an embedder, a directory sync is its own Resolver implementation.
  • 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's upstream_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, state or 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_denied and no error_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.
  • Resolution through an approval record: the user mapping recorded at approval, as a Resolver implementation.
  • The authorization server advertises the approval-continuation profile in its metadata: access_denied with consent_required in error_description, and an error_uri naming 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 the error_uri is a consent link, not a help page. RFC 6749 §5.2 defines error_uri as a page for the client developer, so this profile repurposes it; Mecatl follows it only under the advertised profile, as https on this server's issuer origin. fosite's RFC6749Error has no error_uri field, 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 error and reason.

Depends on

Related: "Delegated access: tokens and actors from third-party issuers" (#7159) covers clients other than Mecatl.

Activity

  1. added
    enhancement
    go
    on Nov 16, 2026
  2. added
    needs-triage
    on Nov 16, 2026
  3. ChrisJBurns commented on Nov 18, 2026

    @ChrisJBurns
    Collaborator

    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 ActIssuer equal to the server's own issuer, so Mecatl registers its agent trust domain (spiffe://<trust domain>) as ActIssuer, and every ID-JAG carries that as act.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 same ActIssuer would match. The source issuer (the ID-JAG's iss) 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 same ActIssuer.

    What changes:

    • Redemption matches the row's source issuer against the verified ID-JAG's iss.
    • The pending approval behind the approval link already comes from the verified ID-JAG, so it records the iss too.
    • Administrator pre-approval names the source issuer.

    Mecatl's design keys it this way: how AS-2 resolves the user and credentials-and-lifecycle.md, step (8), check 9.

  4. removed
    needs-triage
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authenticationenhancementgosecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions