You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Revoke the grant a reused subject token created #6973
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;
Activity