Skip to content

Revoke the grant a reused subject token created #6973

Open

Description

@jhrozek

Part of #6886. Depends on #6897.

Problem: when the response to a grant request is lost, the grant exists but the client never received it. It stays valid until it expires, usable only with the client's credentials. Nothing ends it.

Change: when a request reuses an access token whose jti already created a grant, and the requesting client is that grant's client, revoke the grant (its children become unusable through the parent check) and refuse the request with token_used, as today. A reuse by another client revokes nothing and gets the same refusal, so the response reveals nothing new.

This gives a client a cleanup path: after a lost response, resend once with a new client assertion.

  • If the server never processed the first request, the resend succeeds.
  • If it did, the resend is refused with token_used and the orphan is revoked. The client then asks again with a fresh access token.

Known cost, documented: if two requests present the same access token at the same time, the one that loses the race revokes the grant the other just created, and neither ends up with a usable grant. Clients must not present one access token for two requests.

Implementation:

  • The jti marker already holds the grant's signature.
  • The Redis create script returns it when it refuses, with one extra read.
  • CreateExchangeGrant returns it in a typed error that wraps fosite.ErrJTIKnown.
  • Revoke only when the client matches. Both backends behave the same.
  • Audit: exchange_grant.revoked with reason replayed.

Acceptance:

  • a resend after a lost response revokes the first grant and makes its children unusable;
  • a resend of a request the server never processed succeeds;
  • another client's reuse revokes nothing;
  • two simultaneous requests with one token leave no usable grant, and a fresh token then succeeds;
  • both backends behave the same.

Activity

  1. added
    needs-triage
    on Oct 28, 2026
  2. 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions