Skip to content

Delegated access: subject mapping setting and code gate for ID-JAG issuers #7244

Done

Description

@jhrozek

Part of "Delegated access: subject mapping at ID-JAG redemption" (#6887).

Branch: as2-subject-mapping-1-config (well under 200 lines). Phase: 1.

Problem. AS-2 cannot be told that an issuer's ID-JAGs name a user in AS-2's own user table. Every ID-JAG redemption issues <iss>#<sub>, which is not a local user, so the gateway cannot find that user's connections.

Change. On JWTBearerGrantPolicy, Go-only (json:"-"), set by embedders:

  • subject_mode: namespaced (default, today's behaviour) or resolve. The zero value never selects resolve. resolve implies the marker.
  • actor_issuers: act.iss values accepted besides the ID-JAG's own iss. Mecatl's agent identities come from their own issuer, not AS-1's.
  • Mecatl sets AS-2's trust through the inbound_grants issuer policies, and applyJWTBearerPolicies copies only a fixed set of fields into a new JWTBearerGrantPolicy. So both settings are also added, Go-only, to JWTBearerIssuerPolicyRunConfig and copied there; a test shows they survive that copy.
  • Refusals at startup, each with a test:
    • resolve together with subject_bindings.
    • resolve or actor_issuers on a namespaced issuer.
    • resolve on an issuer that accepts plain jwt_bearer. An empty accepted_assertion_types means both types, so a resolve issuer must set accepted_assertion_types: [id_jag]; that also triggers the existing accepted-audiences check.
    • resolve when AS-2 has no identity-provider upstream (the first upstream, OIDC), because resolution could never succeed.
    • AS-2's own issuer as a trusted issuer is already refused for every issuer today; no change.
  • The code gate: an unexported constant delegatedAccessEnabled = false. While false, every redemption from a resolve issuer is refused with access_denied and subject_unknown, before anything is consumed, and the server logs once at startup that resolution is not enabled in this build. It is not a setting, an acknowledgement or a build tag.

Acceptance. Each refusal has a test with its text. The gate test is built in-package with a resolve policy that would otherwise redeem, so removing the gate changes the result (a resolve issuer without subject_bindings is refused as subject_unknown anyway, so a test through plain config proves nothing). A namespaced issuer is unchanged. docs/arch/17-token-exchange-delegation.md documents the settings and the gate.

Before and after for embedders. Before: no such settings; every redemption issues <iss>#<sub>. After: unchanged for issuers that leave them out; a resolve issuer is refused on every redemption until "Delegated access: turn on subject resolution at ID-JAG redemption" lands.

Depends on. Nothing in code. It lands after tokenexchange-refactor-3-redeemer to avoid rebase churn in the ID-JAG constructor.

Unblocks. With "Delegated access: actor checks at ID-JAG redemption" and "Delegated access: resolve the ID-JAG subject and issue the marked token behind the gate", lets "Configure the embedded gateway's authorization server as AS-2" (stacklok/mecatl) start. That issue is complete only when "Delegated access: turn on subject resolution at ID-JAG redemption" lands.

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

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions