Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validateJWT rejects Non-Integer iat, exp, nbf #263

Closed
2 tasks done
CS-Birb opened this issue Jun 1, 2020 · 1 comment
Closed
2 tasks done

validateJWT rejects Non-Integer iat, exp, nbf #263

CS-Birb opened this issue Jun 1, 2020 · 1 comment
Labels

Comments

@CS-Birb
Copy link

CS-Birb commented Jun 1, 2020

Describe the bug
validateJWT checks if provided iat, nbf and exp claims are Integers, and will throw exceptions if not. Naturally this will cause issues if an identity provider returns a JWT with floating-point NumericDates.

This behaviour appears to be counter to RFC7519, which defines NumericDates as so:

NumericDate

A JSON numeric value representing the number of seconds from
1970-01-01T00:00:00Z UTC until the specified UTC date/time,
ignoring leap seconds. This is equivalent to the IEEE Std 1003.1,
2013 Edition [POSIX.1] definition "Seconds Since the Epoch", in
which each day is accounted for by exactly 86400 seconds, other
than that non-integer values can be represented. See RFC 3339
[RFC3339] for details regarding date/times in general and UTC in
particular.

To Reproduce
Steps to reproduce the behaviour:

  1. Use a auth workflow that returns JWTs with Non-integer NumericDates (I.e. Jetbrains Hub)

Expected behaviour
Non-Integer NumericDate values to be considered valid

Environment:

  • openid-client version: v3.15.0
  • node version: v10.15.3

Additional context
The current behaviour may also be undesired for the auth_time claim. The OpenID Specs use the same language to define the type as with iat and exp

Its value is a JSON number representing the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date/time.

  • the bug is happening on latest openid-client too.
  • i have searched the issues tracker on github for similar issues and couldn't find anything related.
@CS-Birb CS-Birb added the triage label Jun 1, 2020
@CS-Birb CS-Birb changed the title validateJWT rejects Non-Integer iat, exp, nbt validateJWT rejects Non-Integer iat, exp, nbf Jun 1, 2020
@panva panva added bug and removed triage labels Jun 1, 2020
@panva panva closed this as completed in a24a759 Jun 1, 2020
@panva
Copy link
Owner

panva commented Jun 1, 2020

@CS-Birb thanks for bringing it up, it is fixed in v3.15.2

@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants