You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Authorization server: allow clock skew on private_key_jwt client assertions #6954
Problem: the token endpoint checks a private_key_jwt client assertion's time claims with no clock-skew margin. fosite v0.49.0 (client_authentication.go, token.Claims.Valid()) refuses the assertion when the server's clock is past exp or before iat, comparing exact seconds. If the client's clock runs one second ahead of the server's, a freshly signed assertion fails with "Token used before issued" and the client gets invalid_client. Clocks of separate pods drift by a few seconds in normal operation, so a correct client fails now and then, at random.
ToolHive already tolerates 60 seconds of skew on external subject tokens in token exchange (externalClockSkewLeeway, tokenexchange/multi_issuer_validator.go), but not on client assertions.
The only bound on an assertion's lifetime is the fixed MaxAssertionLifespan: exp may be at most 5 minutes after the server's current time (storage/memory.go, storage/redis.go). It ignores iat and cannot be configured.
Change:
Accept a client assertion's exp, iat, and nbf within a clock-skew margin, 60 seconds by default, configurable on the authorization server.
Refuse an assertion whose exp - iat exceeds a configured maximum (RFC 7523 §3 lets the server limit how far in the future exp may be). Keep MaxAssertionLifespan as the upper bound.
Keep each used jti until exp plus the margin, so an assertion cannot be replayed during the margin.
fosite offers no hook for this. One route: handle private_key_jwt in ToolHive's own client authentication strategy, as spiffe_client_auth.go already does for JWT-SVIDs.
Acceptance: an assertion whose iat is 30 seconds in the server's future is accepted; one 90 seconds in the future is refused; an assertion 30 seconds past exp is accepted and its jti cannot be used again; an assertion with exp - iat above the configured maximum is refused.
Mecatl's broker authenticates to the authorization server this way on every token request; its design assumes the margin (credentials-and-lifecycle.md, step 5).
Activity
Allow clock skew on private_key_jwt assertions
Allow clock skew on private_key_jwt assertions
Allow clock skew on private_key_jwt assertions
Allow clock skew on private_key_jwt assertions (stacklok#7088)