From eaa81cf6699b26937d12a0c52d96dc3652b4c013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 28 Oct 2026 15:46:15 +0300 Subject: [PATCH] =?UTF-8?q?=E2=8F=B1=EF=B8=8F=20oidc:=20cache=20im's=20key?= =?UTF-8?q?s=20for=20ten=20minutes,=20so=20a=20withdrawn=20key=20stops=20v?= =?UTF-8?q?erifying=20sooner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/iz-web/src/oidc.rs | 4 ++-- docs/contracts.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/iz-web/src/oidc.rs b/crates/iz-web/src/oidc.rs index 5a73442..ea36a28 100644 --- a/crates/iz-web/src/oidc.rs +++ b/crates/iz-web/src/oidc.rs @@ -2,7 +2,7 @@ //! credentials token that iz uses to read the people directory (section 2.6). //! //! It finds `im`'s endpoints through discovery and keeps them for an hour. It keeps `im`'s signing -//! keys (JWKS) for an hour, and refetches them at most once a minute when a token names a key that +//! keys (JWKS) for ten minutes, and refetches them at most once a minute when a token names a key that //! is not known. It exchanges authorization codes, and it verifies ID tokens and logout tokens. //! //! 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; /// How long discovery is cached, before it is fetched again. const DISCOVERY_TTL: Duration = Duration::from_secs(3600); /// How long the JWKS is cached, before it is fetched again (contracts.md 2.2). -const KEYS_TTL: Duration = Duration::from_secs(3600); +const KEYS_TTL: Duration = Duration::from_secs(600); /// The shortest gap between two JWKS fetch attempts (contracts.md 2.2). It bounds the refetch for unknown /// key ids, and the retries after a failed fetch, so an unreachable `im` is not asked once per request. const UNKNOWN_KEY_REFETCH: Duration = Duration::from_secs(60); diff --git a/docs/contracts.md b/docs/contracts.md index f08fbad..1878e49 100644 --- a/docs/contracts.md +++ b/docs/contracts.md @@ -60,7 +60,7 @@ Clients fetch discovery once at boot and cache it. They may hard-code the paths the last 7 days, as `{"kty":"OKP","crv":"Ed25519","x":...,"kid":...,"use":"sig","alg":"EdDSA"}`. - `im` rotates the signing key every 90 days and on admin demand. A new key is published 24 hours before it signs anything. -- Clients cache the JWKS for 1 hour, and refetch at most once a minute when a token names an unknown `kid`. +- Clients cache the JWKS for 10 minutes, and refetch at most once a minute when a token names an unknown `kid`. ### 2.3 Sign-in (authorization code + PKCE)