-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
isJWT bug #964
Comments
the problem here is that the example |
Sure, I see, our test for |
@jsnoble - PR is welcome! 👍 |
I am doing some research on this issue. Though based on issue #609, the user requested for functionality not to decode JWT but just verify string received. Cc. @jsnoble, @Vengarioth and @profnandaa. |
The test cases for isJWT are not correct. JWT is either 2 (in case of no signature) or 3 [dot] separated base64 strings. The test cases include symbols like _ and - which are not valid base64 characters. The OP has given an example for which the result should be opposite in this case. const jwt = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi0zNWRhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZxH-x5mb11y1537t3rGzcM';
validator.isJWT(jwt); => true as expected // **should be false** |
@profnandaa If the PR #1277 is merged, we can solve this issue. The PR has merge conflicts so I'll be happy to make a new PR if the author isn't active. |
@parasg1999 -- let's wait on @mum-never-proud or if okays you to pick up the PR. |
@parasg1999 -- merged, could you please check if this is solved now? |
|
@parasg1999 -- can check this one? |
I implemented #906. Right now, I want to point out that while implementing that is possible, it's a slippery slope, as then someone else will ask why the library doesn't also check the signature of the JWT, etc. At that point, we may as well just re-implement the entire JWT standard :) |
There is a problem with the method isJWT in that it returns true for incorrect values
The text was updated successfully, but these errors were encountered: