forge
Explore
Log in

Don't you dare go Hollow

⏱️ oidc: cache im's keys for ten minutes, so a withdrawn key stops verifying sooner

Browse files at this commit

eaa81cf6699b26937d12a0c52d96dc3652b4c013Ahmet Kaan GümüşParent: 56e88c8
crates/iz-web/src/oidc.rsmodified+2 -2
@@ -2,7 +2,7 @@
2 //! credentials token that iz uses to read the people directory (section 2.6).2 //! credentials token that iz uses to read the people directory (section 2.6).
3 //!3 //!
4 //! It finds `im`'s endpoints through discovery and keeps them for an hour. It keeps `im`'s signing4 //! It finds `im`'s endpoints through discovery and keeps them for an hour. It keeps `im`'s signing
5-//! keys (JWKS) for an hour, and refetches them at most once a minute when a token names a key that5+//! keys (JWKS) for ten minutes, and refetches them at most once a minute when a token names a key that
6 //! is not known. It exchanges authorization codes, and it verifies ID tokens and logout tokens.6 //! is not known. It exchanges authorization codes, and it verifies ID tokens and logout tokens.
7 //!7 //!
8 //! It decides nothing about who may sign in: that is `pages/sign_in.rs` and the store. It keeps no8 //! It decides nothing about who may sign in: that is `pages/sign_in.rs` and the store. It keeps no
@@ -52,7 +52,7 @@ pub const MAX_RESPONSE_BYTES: usize = 256 * 1024;
52 /// How long discovery is cached, before it is fetched again.52 /// How long discovery is cached, before it is fetched again.
53 const DISCOVERY_TTL: Duration = Duration::from_secs(3600);53 const DISCOVERY_TTL: Duration = Duration::from_secs(3600);
54 /// How long the JWKS is cached, before it is fetched again (contracts.md 2.2).54 /// How long the JWKS is cached, before it is fetched again (contracts.md 2.2).
55-const KEYS_TTL: Duration = Duration::from_secs(3600);55+const KEYS_TTL: Duration = Duration::from_secs(600);
56 /// The shortest gap between two JWKS fetch attempts (contracts.md 2.2). It bounds the refetch for unknown56 /// The shortest gap between two JWKS fetch attempts (contracts.md 2.2). It bounds the refetch for unknown
57 /// key ids, and the retries after a failed fetch, so an unreachable `im` is not asked once per request.57 /// key ids, and the retries after a failed fetch, so an unreachable `im` is not asked once per request.
58 const UNKNOWN_KEY_REFETCH: Duration = Duration::from_secs(60);58 const UNKNOWN_KEY_REFETCH: Duration = Duration::from_secs(60);
docs/contracts.mdmodified+1 -1
@@ -60,7 +60,7 @@ Clients fetch discovery once at boot and cache it. They may hard-code the paths
60 the last 7 days, as `{"kty":"OKP","crv":"Ed25519","x":...,"kid":...,"use":"sig","alg":"EdDSA"}`.60 the last 7 days, as `{"kty":"OKP","crv":"Ed25519","x":...,"kid":...,"use":"sig","alg":"EdDSA"}`.
61 - `im` rotates the signing key every 90 days and on admin demand. A new key is published 24 hours before it61 - `im` rotates the signing key every 90 days and on admin demand. A new key is published 24 hours before it
62 signs anything.62 signs anything.
63-- Clients cache the JWKS for 1 hour, and refetch at most once a minute when a token names an unknown `kid`.63+- Clients cache the JWKS for 10 minutes, and refetch at most once a minute when a token names an unknown `kid`.
64 64
65 ### 2.3 Sign-in (authorization code + PKCE)65 ### 2.3 Sign-in (authorization code + PKCE)
66 66