fix(auth): cap JWT token-exchange lifetime to subject expiry#5039
fix(auth): cap JWT token-exchange lifetime to subject expiry#5039vigneshio wants to merge 1 commit into
Conversation
Token exchange previously minted a new access token with a full maxTokenGeneration window, so a valid subject token could be exchanged indefinitely to refresh session lifetime. Cap exchanged tokens to the remaining subject lifetime (still bounded by maxTokenGeneration). Also stop treating a non-Basic Authorization header as authentication for the token endpoint; exchange is allowed with subject_token alone but cannot outlive that subject.
5826676 to
14efb2c
Compare
adutra
left a comment
There was a problem hiding this comment.
@vigneshio I'm afraid we can't accept this PR 😞
Exchanged tokens are now capped to the remaining subject lifetime
In a "real" token exchange grant, that's indeed the best thing to do. However, here we are abusing the token exchange grant for something it wasn't designed for: refreshing tokens. This is exactly how the Iceberg OAuth2 client behaves. IOW, it's not a bug, it's a feature 😄
stop treating a non-Basic Authorization header as client credentials for the token endpoint;
Same thing: this is indeed non-standard, but that's how the Iceberg client refreshes tokens by default: the Authorization header will contain Bearer <token> and <token> will be identical to the subject token.
Thanks for the context, @adutra - Makes sense - closing this out. |
Internal JWT token exchange no longer issues an access token that outlives the subject token.
Previously each exchange reset expiry to a full
maxTokenGenerationwindow, so a valid (or stolen) access token could be refreshed indefinitely. Exchanged tokens are now capped to the remaining subject lifetime (and still tomaxTokenGeneration).Also stop treating a non-Basic
Authorizationheader as client credentials for the token endpoint; exchange withsubject_tokenalone is allowed but cannot extend session lifetime.