Skip to content

Fixed now causes iat to exceed now + leeway in JWTClaimsRegistry.validate_iat() #68

Closed

Description

@kimminw00

def validate_iat(self, value: int) -> None:
"""The "iat" (issued at) claim identifies the time at which the JWT was
issued. This claim can be used to determine the age of the JWT. Its
value MUST be a number containing a NumericDate value. Use of this
claim is OPTIONAL.
"""
if not _validate_numeric_time(value):
raise InvalidClaimError("iat")
if value > (self.now + self.leeway):
raise InvalidTokenError()
self.check_value("iat", value)

When calling claims_requests.validate(decoded_token.claims), the now timestamp used for validation isn’t updated dynamically resulting in iat > now + leeway.

Activity

  1. changed the title [-]Fixed `now` causes `iat` to exceed `now + leeway` in `ClaimsRegistry.validate()`[/-] [+]Fixed `now` causes `iat` to exceed `now + leeway` in `JWTClaimsRegistry.validate_iat()`[/+] on Jul 29, 2025
  2. lepture commented on Jul 30, 2025

    @lepture
    Member

    This is caused by the way you use the claims registry. You need to initialize a claims request every time you want to do the claim validation.

  3. lepture commented on Jul 30, 2025

    @lepture
    Member

    However, I can update the implementation so that the validator can be reused.

  4. added this to the milestone on Aug 8, 2025
  5. added a commit that references this issue on Aug 25, 2025
  6. lepture commented on Aug 25, 2025

    @lepture
    Member

    Please check the code in main branch.

  7. kimminw00 commented on Aug 25, 2025

    @kimminw00
    Author

    I've reviewed the code in the main branch! LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions