Skip to content

fix(workloadapi): refresh cached JWT SVIDs without iat#430

Open
maxlambrecht wants to merge 1 commit intospiffe:mainfrom
maxlambrecht:fix/cached-jwt-svid-missing-iat
Open

fix(workloadapi): refresh cached JWT SVIDs without iat#430
maxlambrecht wants to merge 1 commit intospiffe:mainfrom
maxlambrecht:fix/cached-jwt-svid-missing-iat

Conversation

@maxlambrecht
Copy link
Copy Markdown
Member

What

Update CachedJwtSource so cached JWT SVIDs without an iat claim are treated as needing refresh instead of computing half-life from a missing issued-at value.

Add a regression test that seeds the cache with a JWT SVID containing sub and exp but no iat, then verifies the cache path does not throw NullPointerException.

Why

JwtSvid parsing currently allows JWT SVIDs without iat, but CachedJwtSource.isTokenPastHalfLifetime assumed getIssuedAt() was always available. That could crash cache reuse with a NullPointerException.

The fix keeps JWT SVID validation behavior unchanged and makes only the cache behavior more conservative.

How tested

Ran:

./gradlew :java-spiffe-core:test --tests io.spiffe.workloadapi.CachedJwtSourceTest --tests io.spiffe.workloadapi.DefaultJwtSourceTest

@maxlambrecht maxlambrecht requested a review from rturner3 as a code owner May 9, 2026 19:11
Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
@maxlambrecht maxlambrecht force-pushed the fix/cached-jwt-svid-missing-iat branch from b606c56 to 81c9d49 Compare May 9, 2026 20:37
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.

1 participant