Repository navigation
Description
Bug description
Since #6677, the ID-JAG handler lets a public client redeem an ID-JAG by sending only its client_id. This was a deliberate choice, and the PR described it as a trade-off. It is worth revisiting.
- fosite returns a public client as soon as the form
client_idresolves to one (client_authentication.go:if client.IsPublic() { return client, nil }). No secret or key is needed. checkClientBinding(pkg/authserver/server/tokenexchange/id_jag_handler.go) then compares the assertion'sclient_idclaim with that resolved client's ID. For a public client, whoever presents the assertion supplies the formclient_id, so they can copy it from the assertion. The binding checks nothing in that case.- The handler ignores the client's
grant_types, so every public client (open-DCR clients withnone, CIMD clients) can reach it. Configured delegate clients, confidential DCR clients and SPIFFE clients are confidential.
draft-ietf-oauth-identity-assertion-authz-grant-04:
- §9.1: "This specification SHOULD only be supported for confidential clients. Public clients SHOULD use the existing authorization code grant and redirect the user to the Resource Authorization Server..."
- §5: requiring a confidential client "helps to prevent the IdP Authorization Server from delegating access to any of the valid clients for the Resource Authorization Server."
- §4.4.1: the
client_idclaim "MUST identify the same client as the client authentication in the request."
The #6677 description says: "Draft §9.1 RECOMMENDS confidential redeeming clients; this accepts identified public clients too ... If you'd rather gate public clients behind config, that's an easy follow-up knob on the issuer policy." This issue is that follow-up.
Steps to reproduce
- Enable a JWT-bearer issuer policy with a subject binding.
- Register a public client (DCR, auth method
none). - Redeem an IdP-minted ID-JAG for that client using
grant_type,assertion,client_idandresource, with no secret.
An access token is issued. The only limits are the single-use jti, max_assertion_age, audience matching and the subject binding's allowed resources. No refresh token is issued.
Expected behavior
Public clients are refused unless an operator opts in for that issuer.
Actual behavior
Any holder of a valid, unused ID-JAG for a public client can redeem it. For example, if the assertion leaks from a proxy log or browser history before the legitimate client redeems it, the leaker gets an access token for that user, and the legitimate redemption then fails because the jti is spent. With a confidential client the same leak is useless without the secret or key.
Additional context
- In this repo, vMCP's XAA strategy sends HTTP Basic only when it has both a client ID and a secret (
pkg/oauthproto/grants.go), so it does not depend on public redemption. pkg/authserver/integration_test.go(around line 7253) redeems with a public client, so it will need updating.- Settings for the issuer policy live in
JWTBearerGrantPolicy(pkg/authserver/server/tokenexchange/multi_issuer_validator.go),JWTBearerIssuerPolicyRunConfig(pkg/authserver/inbound_grants.go) and the CRD'sJWTBearerGrantConfig.
Proposed fix
Add a per-issuer opt-in, default off: allow_public_id_jag_clients in RunConfig and allowPublicIDJAGClients in the CRD. In IDJAGHandler, reject client.IsPublic() with unauthorized_client after the client binding check and before the assertion is consumed, unless the flag is set. Update the handler comment and docs/arch/17-token-exchange-delegation.md, regenerate the CRDs, swagger and SDK, and add a release note.
Behavior change: a public client that redeems ID-JAGs today stops working until the operator sets the flag or moves the client to a confidential registration. Before choosing this, confirm that the deployments that motivated #6677 can do one of the two.
Alternatives: refuse public clients outright (breaks those deployments, no escape hatch), or keep the current behavior and document the risk.
Acceptance criteria
- A public client redeeming an ID-JAG gets
unauthorized_clientby default, and thejtistays unconsumed. - With the flag on, public redemption works as it does today.
- Confidential,
private_key_jwtand SPIFFE clients work regardless of the flag. - The flag is accepted in RunConfig and the CRD, converted correctly, and covered by tests (RunConfig normalization, operator conversion, CRD round-trip).
- The docs explain the trade-off and cite §9.1.
Activity
Refuse unauthenticated ID-JAG clients and cnf-bound assertions (stack…