Skip to content

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

Merged
maxlambrecht merged 1 commit into
spiffe:mainfrom
maxlambrecht:fix/cached-jwt-svid-missing-iat
Jul 23, 2026
Merged

fix(workloadapi): refresh cached JWT SVIDs without iat#430
maxlambrecht merged 1 commit into
spiffe: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
@maxlambrecht
maxlambrecht force-pushed the fix/cached-jwt-svid-missing-iat branch from b606c56 to 81c9d49 Compare May 9, 2026 20:37
@maxlambrecht
maxlambrecht force-pushed the fix/cached-jwt-svid-missing-iat branch from 81c9d49 to 65175f4 Compare July 18, 2026 20:36
@maxlambrecht
maxlambrecht force-pushed the fix/cached-jwt-svid-missing-iat branch from cba0ae8 to 4853b2c Compare July 23, 2026 15:31
Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
@maxlambrecht
maxlambrecht force-pushed the fix/cached-jwt-svid-missing-iat branch from 4853b2c to e5a9e48 Compare July 23, 2026 15:41
@maxlambrecht
maxlambrecht merged commit acea6f0 into spiffe:main Jul 23, 2026
8 checks passed
@maxlambrecht
maxlambrecht deleted the fix/cached-jwt-svid-missing-iat branch July 23, 2026 15:41
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.

2 participants