OAuth JWT and JWK limits #2722
-
OAuth looks good so far, but I have a couple of questions regarding practical limits on the number of JWTs and JWKs. In the context of generating OAuth requests, is state validated as globally unique, and is that forever or just at any given time? For example, an oauth_request with state=foo1 is sent and concludes successfully; later, if another request with state=foo1 is used, are previous states purged so that the later use of foo1 will succeed? For DPOP, are handle JWKs meant to be recycled? For example, if a user goes through the OAuth session creation process and a JWK is created for the user to create proofs, later, if the user creates a new session (like on a different device), is the same DPOP JWK meant to be reused but with a different nonce? I don't see anything that shows when DPOPs expire server-side. If DPOP JWKs are meant to be long-lived and span multiple sessions, is there a way to either set a hint (i.e. Smoke Signal will use this DPOP JWK for at most 28 days) or get a ttyl value from the server? On the other hand, if DPOPs are not long-lived and expire when the aggregate sessions for any access tokens associated with refresh tokens expire, can that be confirmed? Do DPoP nonces expire deterministically, and is there a way to request a nonce with a signed request if we know one is expired without implementing retry mechanics? The current limitation with DPoP nonces is that they force all requests to be serial because there's no guarantee that any given request will be rejected due to a new nonce being needed, and if that value does change, any other future requests need to rely on it. If that were time-boxed or if the nonce was counter based, it'd at least give implementations a way of knowing that the Nth request or after N seconds a new nonce would need to be used. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
From the spec:
This isn't entirely clear. Is it saying that the PDS is creating an association between the provided DPoP JWKs and access_tokens with the public keys listed by the client application (i.e., https://smokesignal.events/oauth/jwks.json )? How flexible is that to server failure? Like, if those JWKs are serviced by a content accelerator that has a delay in updating, so one region has kids 1, 2, and 3, while another region has kids 2, 3, and 4, does that mean that requests with the new key (4) could blip out if a refresh call accidentally gets the old set of 1, 2, and 3? |
Beta Was this translation helpful? Give feedback.
-
From the spec:
Does the same hold true with DPoP keys? If DPoP keys are meant to be long-lived and recycled between handle sessions, should they be proactively expired after ~30 day window? |
Beta Was this translation helpful? Give feedback.
-
In short: Dpop keys must never leave the device they were created on (whether it's a server or a end-user device). Ideally, one dpop key should be used for one, and only one, oauth session. The dpop key can be used for as long as the access/refresh tokens of the particular oauth session the drop key was bound to are valid. There is no mechanism to rotate the dpop key bound to a pair of tokens other than initiating a new oauth flow to retrieve new tokens. Oauth servers should prevent the same dpop key to be used, in particular when the client is not a confidential client. As for the dpop nonces: they stay valid (and identical for every user) for a short period of time. When a new nonce is created on the server, the previously advertised nonce can still be used for a short period of time. This means that the client can safely run multiple requests in parallel as long as a recent nonce is used (or they would all fail). We will make sure to include these clarifications in the spec. |
Beta Was this translation helpful? Give feedback.
-
As for the "state", oauth does not prevent the state from being re-used. The oauth (oidc) "nonce" oauth request parameter (not to be confused with the Dpop nonce), however, must be unique to every oauth request. That being said, there is a wide variety of attacks that involve manipulating the state. For that reason, it is recommended to store the actual state data on the device/server, and use a random value as oauth request parameter. Clients should invalidate the encoded state (= the random value) once it was used in order to prevent an attacker from forcing a user to re-authenticating using an old state. |
Beta Was this translation helpful? Give feedback.
Old keys should still be advertised in the jwks but no longer used to initiate new sessions. If a key is known to have been compromised, it must be removed from the jwks, effectively preventing it from being used to refresh sessions.