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
When validating the exp claim, pyjwt checks if exp < (now - leeway), and throws an error if so. I would expect this condition to be exp <= (now - leeway).
The "exp" (expiration time) claim identifies the expiration time on
or after which the JWT MUST NOT be accepted for processing.
which is a bit ambiguous. But also says:
The processing of the "exp" claim requires that the current date/time
MUST be before the expiration date/time listed in the "exp" claim.
Which seems more concrete.
Expected Result
When exp == datetime.now(), throw a validation error for exp
Actual Result
A validation error is not thrown until the next second.
Reproduction Steps
importjwtimporttimeimportdatetimefromdatetimeimporttimezonejwt_payload=jwt.encode(
{"exp": datetime.datetime.now(tz=timezone.utc) },
"secret",
)
# does not throw an exceptionjwt.decode(jwt_payload, "secret", leeway=0, algorithms=["HS256"])
When validating the
exp
claim, pyjwt checks ifexp < (now - leeway)
, and throws an error if so. I would expect this condition to beexp <= (now - leeway)
.https://github.com/jpadilla/pyjwt/blob/master/jwt/api_jwt.py#L233-L234
The RFC describes the expiration claim:
which is a bit ambiguous. But also says:
Which seems more concrete.
Expected Result
When
exp
==datetime.now()
, throw a validation error forexp
Actual Result
A validation error is not thrown until the next second.
Reproduction Steps
System Information
The text was updated successfully, but these errors were encountered: