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

Verifications not functioning in latest release #128

Closed
tpickett66 opened this issue Feb 23, 2016 · 4 comments
Closed

Verifications not functioning in latest release #128

tpickett66 opened this issue Feb 23, 2016 · 4 comments

Comments

@tpickett66
Copy link
Contributor

After updating an app to 1.5.2 we're seeing some test failures due to exceptions not being raised when issuer, audience, and subject claims are mismatched. I'll investigate further and add info as I find it.

@tpickett66
Copy link
Contributor Author

Haha, after trying to reproduce the issue outside the app I'm not seeing it. Sorry for the false alarm.

@tpickett66
Copy link
Contributor Author

As it turns out there was a change. The verification routines still work but only when all keys in the options hash are symbols, previously both symbol and string keys worked.

require 'jwt'

key = 'superSekretK3yz!'
config = {
  'iss' => 'foo'
}

payload = {
  foo: 'bar',
}

token = JWT.encode(config.merge(payload), key)
decoded = JWT.decode(token, key, true, {'iss' => 'other', 'verify_iss' => true}) # succeeds
decoded = JWT.decode(token, key, true, {'iss' => 'other', verify_iss: true}) # succeeds
decoded = JWT.decode(token, key, true, {iss: 'other', 'verify_iss' => true}) # succeeds
decoded = JWT.decode(token, key, true, {iss: 'other', verify_iss: true}) # fails to decode

Edit: Edited to add additional information and modify the repro script.

@tpickett66
Copy link
Contributor Author

Looks using the above as the basis of a good/bad script for git bisect I landed on c490860 as the first commit with the changed behavior. Based on the commit message Change hash syntax it looks like the change was intentional :-(

@excpt
Copy link
Member

excpt commented Feb 24, 2016

Thanks for the feedback and your investigation results.
This is a nice solution for the string vs. hash situation.
Thanks for the contribution.

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

2 participants