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
Per-user revocation time for grants issued by token exchange #6972
Problem: there is no way to end everything a user has delegated. A user who signs out everywhere, or whom an administrator offboards, keeps several things:
grants that clients still hold, or have lost track of, such as one left by a lost response;
login refresh tokens at other clients;
login sessions.
Revoking grants one by one needs the client to know all of them, and the server keeps no index from user to grants.
Change:
A per-user revocation record: time and reason, keyed by the user's sub. Recording it is idempotent; a later record moves the time forward.
Effects:
a grant created no later than that time is refused at use, with the recorded reason. For a child, its parent's creation time counts;
an access token whose iat is no later than that time is refused as a subject token for new grants;
the user's login refresh tokens are revoked;
the user's login sessions are ended.
Who may start it: the user, with a fresh access token, or an administrator or embedder in process. The endpoint or API shape is decided in this issue.
No user-to-grant index: the check is by time. Revoking login refresh tokens needs a way to find them by user, which is designed here.
Audit: a user.revoked log line with sub, reason, and who started it.
Acceptance:
after a revocation, a grant created before it, and its children, are refused with the recorded reason;
a grant created after a new sign-in works;
an access token issued before the revocation cannot create a grant;
the user's login refresh tokens are refused at the refresh grant;
a second revocation with a later time supersedes the first.
Three things in this design that I think will decide whether it works in practice. All from having built the same primitive (per-call tokens + revocation) and having got the boundary cases wrong first.
1. iat granularity makes < vs <= a real decision, not a style choice.
The spec says "an access token whose iat is no later than that time is refused". If iat is an integer second — which it is for most issuers — then a grant issued at T and a revocation recorded at T are indistinguishable. Two failure modes, and you have to pick which one you accept:
Using <=: a grant legitimately created before the revocation within the same second is refused. Fail-closed, so it's the safer error, but it produces a support ticket that looks like a bug.
Using <: a grant created in the same second as the revocation survives until expiry. That's the one an attacker wants, because a revocation usually follows the detection of abuse — not the other way around.
If the revocation record can carry a monotonic counter or a nanosecond timestamp alongside the wall-clock time, the ambiguity disappears. Worth deciding now rather than when someone reports it.
2. Clock skew between the issuer's iat and the admin's revocation time.
These two timestamps come from different places: iat is stamped by the authorization server; the revocation time is stamped when the admin request is handled. If they compare raw, skew of a few hundred ms flips the boundary in both directions. Since you're already keying by sub (issuer + subject), storing the revocation time from the same clock domain that stamps iat removes an entire class of "it didn't revoke" reports.
3. What is the intended behaviour for an in-flight task?
This issue is precise about new grants and subject tokens, and silent about a task that is mid-execution: a delegated agent that has already obtained a grant and is on tool call 7 of 12 when the revocation lands. Three defensible answers — hard-abort, refuse-new-sub-calls-only, or let the grant run to its natural end — and each fails differently. Hard-abort can leave half-written state; let-it-finish means the revocation is advisory for the duration of the task; refuse-new-sub-calls-only is the middle path, but it requires being able to answer "what does this running task hold right now" on demand, which rules out a snapshot taken at grant time.
I picked refuse-new-sub-calls-only and the price was that every check is a live resolution, not a cached decision. If you go that way it's worth writing the cost down explicitly, because the natural optimisation later (cache the decision for 30s) silently converts the guarantee back into the thing this issue exists to fix.
No objection to the design — the "no user-to-grant index, check by time" tradeoff is the right one for this, since an index from user to every grant would itself be a new thing to keep consistent.
Activity
01men commentedon Oct 31, 2026
Three things in this design that I think will decide whether it works in practice. All from having built the same primitive (per-call tokens + revocation) and having got the boundary cases wrong first.
1.
iatgranularity makes<vs<=a real decision, not a style choice.The spec says "an access token whose
iatis no later than that time is refused". Ifiatis an integer second — which it is for most issuers — then a grant issued atTand a revocation recorded atTare indistinguishable. Two failure modes, and you have to pick which one you accept:<=: a grant legitimately created before the revocation within the same second is refused. Fail-closed, so it's the safer error, but it produces a support ticket that looks like a bug.<: a grant created in the same second as the revocation survives until expiry. That's the one an attacker wants, because a revocation usually follows the detection of abuse — not the other way around.If the revocation record can carry a monotonic counter or a nanosecond timestamp alongside the wall-clock time, the ambiguity disappears. Worth deciding now rather than when someone reports it.
2. Clock skew between the issuer's
iatand the admin's revocation time.These two timestamps come from different places:
iatis stamped by the authorization server; the revocation time is stamped when the admin request is handled. If they compare raw, skew of a few hundred ms flips the boundary in both directions. Since you're already keying bysub(issuer + subject), storing the revocation time from the same clock domain that stampsiatremoves an entire class of "it didn't revoke" reports.3. What is the intended behaviour for an in-flight task?
This issue is precise about new grants and subject tokens, and silent about a task that is mid-execution: a delegated agent that has already obtained a grant and is on tool call 7 of 12 when the revocation lands. Three defensible answers — hard-abort, refuse-new-sub-calls-only, or let the grant run to its natural end — and each fails differently. Hard-abort can leave half-written state; let-it-finish means the revocation is advisory for the duration of the task; refuse-new-sub-calls-only is the middle path, but it requires being able to answer "what does this running task hold right now" on demand, which rules out a snapshot taken at grant time.
I picked refuse-new-sub-calls-only and the price was that every check is a live resolution, not a cached decision. If you go that way it's worth writing the cost down explicitly, because the natural optimisation later (cache the decision for 30s) silently converts the guarantee back into the thing this issue exists to fix.
No objection to the design — the "no user-to-grant index, check by time" tradeoff is the right one for this, since an index from user to every grant would itself be a new thing to keep consistent.