Skip to content

fix(workloadapi): refresh cached JWT SVIDs when any is past half its lifetime - #538

Open
cvas22 wants to merge 1 commit into
spiffe:mainfrom
cvas22:fix/cached-jwt-svids-all-fresh
Open

cvas22 wants to merge 1 commit into
spiffe:mainfrom
cvas22:fix/cached-jwt-svids-all-fresh

Conversation

@cvas22

@cvas22 cvas22 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #537

CachedJwtSource.getJwtSvids served a cached list as long as its first JWT-SVID was within half its lifetime, without looking at the others. SVIDs for the same audience can have different lifetimes, so a later one with a shorter TTL could come back from fetchJwtSvids after its half lifetime, or after it had already expired. The cache check now requires every SVID in the list to be fresh, in both the fast path and the synchronized re-check.

Added a test that seeds the cache with a fresh SVID followed by one past half its lifetime and checks that fetchJwtSvids refetches instead of returning it. Changelog entry under Fixed.

Notes

Ran the Build workflow on my fork: linux JDK 17/21/25 passed, the macOS jobs never got a runner (GitHub capacity), so CI here will cover those.

…lifetime

CachedJwtSource only checked the first SVID of a cached list, so a later
SVID with a shorter lifetime could be served after its half lifetime or
even after it expired.

Fixes spiffe#537

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
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.

CachedJwtSource only checks the first cached JWT-SVID before serving the list

1 participant