Repository navigation
feat(kyc-controller): add JWKS cache - #10894
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
amitabh94
previously approved these changes
Oct 19, 2026
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
…tl-cache Co-authored-by: Cursor <cursoragent@cursor.com>
…nto jl/KYC-47/jwks-1day-ttl-cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds 1d TTL caching idOS JWKS fetches
See: https://consensyssoftware.atlassian.net/browse/KYC-47
Screen.Recording.2026-10-20.at.12.05.21.PM.mov
Notice the second token refresh does not result in jwks.json fetches
Note
Medium Risk
JWKS caching affects JWT verification during UKYC session creation; a stale key set could persist up to 24h unless invalidated, though issuer rotation is expected to be infrequent.
Overview
Caches idOS JWKS fetches for 24 hours in
KycServiceso repeated UKYC session verification does not hit the enclave and relay well-known endpoints on every call.#fetchWellKnownJwksnow goes throughfetchQuerywith a one-daystaleTimeand matchinggcTime(so entries are not garbage-collected while still fresh). Only successful, validated JWKS responses are cached; HTTP failures and malformed bodies are retried on the next call, and concurrent callers for the same URL share a single in-flight request.fetchIdosEnclaveJwksandfetchIdosRelayJwksinherit this behavior; docs and the changelog note thatKycService:invalidateQueriesclears these entries. Tests cover TTL reuse, no caching on errors, deduplication, and test teardown viaservice.destroy().Reviewed by Cursor Bugbot for commit 055abd7. Bugbot is set up for automated code reviews on this repo. Configure here.