Skip to content

Configured delegate client with api_audience can exchange for API access tokens #7026

Closed

Description

@ChrisJBurns

Part of #6886.

Problem

A configured delegate client sets token_exchange.api_audience so that it can exchange a user's API access token for an exchange-grant refresh token. To do that, the API audience must also be one of the client's audiences (pkg/authserver/server/registration/configured_client.go:367 at v0.60.0).

The problem is that listing the API audience opens the ordinary access-token exchange path too. A request with requested_token_type=urn:ietf:params:oauth:token-type:access_token and an allowed source client's token goes to the default handler, which issues an access token for the API audience with act.sub set to the delegate (pkg/authserver/server/tokenexchange/handler.go, around lines 752, 939-945, and 1004-1021). The delegate can then call the API as the user, although api_audience was meant to be a narrow input policy, not a way to obtain that audience.

The description of #6988 lists this as "api_audience widens the audiences a delegate can reach: Not addressed; needs review" (open risk 2).

Mecatl's credential broker is the first such delegate, and its design requires that the broker can never mint Mecatl API tokens (credentials-and-lifecycle.md, (3) Session open).

Change

When a delegate client sets api_audience, the access-token exchange path refuses to issue tokens for that audience to it. The audience stays acceptable only as the subject token's audience on the exchange-grant path. Another option is a per-client setting that limits the output token types the client may request.

Acceptance

  • A delegate with api_audience = X that exchanges an allowed source client's token for an access token with audience X is refused.
  • The same delegate still gets an exchange-grant refresh token from that token.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions