{"action":"opened","issue":{"url":"https://api.github.com/repos/progrium/ruby-jwt/issues/77","labels_url":"https://api.github.com/repos/progrium/ruby-jwt/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/progrium/ruby-jwt/issues/77/comments","events_url":"https://api.github.com/repos/progrium/ruby-jwt/issues/77/events","html_url":"https://github.com/progrium/ruby-jwt/issues/77","id":73088402,"number":77,"title":"TypeError when specifying a wrong algorithm","user":{"login":"toshe","id":1636022,"avatar_url":"https://avatars.githubusercontent.com/u/1636022?v=3","gravatar_id":"","url":"https://api.github.com/users/toshe","html_url":"https://github.com/toshe","followers_url":"https://api.github.com/users/toshe/followers","following_url":"https://api.github.com/users/toshe/following{/other_user}","gists_url":"https://api.github.com/users/toshe/gists{/gist_id}","starred_url":"https://api.github.com/users/toshe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toshe/subscriptions","organizations_url":"https://api.github.com/users/toshe/orgs","repos_url":"https://api.github.com/users/toshe/repos","events_url":"https://api.github.com/users/toshe/events{/privacy}","received_events_url":"https://api.github.com/users/toshe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-04T18:14:46Z","updated_at":"2015-05-04T18:14:46Z","closed_at":null,"body":"So I ran my usual tests against tampered keys and I got a TypeError under MRI (2.0):\r\n\r\n1. Provide a tampered token with `\"alg\": \"HSMAC\"` (with a valid signature)\r\n2. Try to verify the token with an RSA public key\r\n3. `TypeError: no implicit conversion of OpenSSL::PKey::RSA into String` \r\n\r\nI'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.\r\n\r\nI've recently read the [article](https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/) about possible security flaws in the library. \r\nI really liked the suggestion to also pass the algorithm and not just the key when verifying the token. Any thoughts on that?\r\n\r\n\r\n\r\n"}}