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

TypeError when specifying a wrong algorithm #77

Closed
toshe opened this issue May 4, 2015 · 1 comment
Closed

TypeError when specifying a wrong algorithm #77

toshe opened this issue May 4, 2015 · 1 comment

Comments

@toshe
Copy link

toshe commented May 4, 2015

So I ran my usual tests against tampered keys and I got a TypeError under MRI (2.0):

  1. Provide a tampered token with "alg": "HSMAC" (with a valid signature)
  2. Try to verify the token with an RSA public key
  3. TypeError: no implicit conversion of OpenSSL::PKey::RSA into String

I've monkeypatched my app to also rescue TypeError and not just DecodeError but this is just a temporary solution. Interestingly the error does not appear under JRuby.

I've recently read the article about possible security flaws in the library.
I really liked the suggestion to also pass the algorithm and not just the key when verifying the token. Any thoughts on that?

@AlexParamonov
Copy link

Regarding passing the algo. It has been merged: https://github.com/progrium/ruby-jwt/pull/71/files#diff-561abf25ed278547a89be325d40babacR126 and on ruby gems now.

@excpt excpt closed this as completed May 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants