Skip to content

fix(oauth): expire the cached oidc jwks after one hour - #369

Merged
BryanFRD merged 1 commit into
mainfrom
fix/349-jwks-max-age
Oct 25, 2026
Merged

BryanFRD merged 1 commit into
mainfrom
fix/349-jwks-max-age

Conversation

@BryanFRD

Copy link
Copy Markdown
Contributor

The JWKS cache was served forever while it contained the token's kid, so a key dropped by the IdP kept verifying until restart. The cache now expires after 1 h; the 60 s minimum between refreshes for unknown kids is unchanged.

Closes #349

@ferrfleet-interne ferrfleet-interne Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct. The max-age check runs before both the kid hit and the JWKS_MIN_REFRESH grace path, so a stale set can't be served, and keys_for refetches and resets fetched_at as before. The test covers both sides of the boundary for Some(kid) and None.

Expected side effect: once the hour is up, a failed JWKS fetch now fails login instead of falling back to the stale set. That fits what this PR is for.

@BryanFRD
BryanFRD merged commit c4a3867 into main Oct 25, 2026
19 checks passed
@BryanFRD
BryanFRD deleted the fix/349-jwks-max-age branch October 25, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(oauth): expire the cached oidc jwks so dropped keys stop verifying

1 participant