-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Stop rejecting tokens with future :iat values. #49
Conversation
Partially addresses funcool#39.
I don't agree that ignoring |
Hi @delitescere! Yes, my main motivation for PR was to get rid of occasional errors on But I have a better argument for this PR to be merged: validation of
There's also no such validation suggested in OAuth 2.0 or OpenID Connect 1.0 specs. After all, we should trust spec authors who already thought through all the security concerns and mitigation strategies and leave implementing "home-grown" validations up to consumers. Note that I didn't touch
I agree that this PR may be considered a breaking change for some consumers and this can be addressed by bumping the major number in semantic version of the lib. |
There's also nothing in my assumption that the Issued At and Not Before values are anywhere near to close. I may issue a token now that isn't to be used before 10 minutes from now. Even so, if the recipient receives the token with an Issued At after the Not Before, let alone now, it is invalid. Again, I understand the compulsion. I don't agree with the impact. |
Funny |
It looks like you have some concerns with OAuth spec, me too. But I guess we have to work with what we have.
Yes, logically, it looks odd. But what is a security risk of approving such token in the client? |
That's the point: like so many security-weakening decisions, we are relying on hindsight to define correct behaviour. "Ooops, I didn't realise they'd do that and open a vulnerability". Let's say the consumer of the token is running on a host where the clock is being manipulated externally by a bad actor. The bad actor doesn't have direct access to the consumer host, nor any part of the system to do with the issuer, nor is able to generate or manipulate the token, but is able to replay arbitrary previous tokens. Perhaps the bad actor has hijacked the NTP responses the consumer's host is receiving and pushing its clock backwards. Some other component on the consumer is relying on the receipt of a valid token and then performing another action (e.g. removing all the cash in your bank account) based on the time. Or, a PRNG might be involved and because the clock is being manipulated, non-determinism in the "random" data has been removed. Because neither the issuer's clock nor the token can be manipulated, the window of this attack is either totally closed, or only as small as the leeway the consumer has applied to account for clock skew, if the However the vulnerability is exploited doesn't actually matter. What matters is that something which has a singular role in providing a security function should not be weakening that function simply because someone can't imagine how it might be weakening it, and our future selves aren't in a situation saying "Why, for bacon's sake, did we do that?". |
OK, maybe discussing the particular attack is not productive because we disagree on the higher level. Personally, I'd like the library to adhere to next statements:
|
@metametadata On reflection, I totally agree about point about the library validations, and thus the rest of your message. The JWT spec is weak, not the library. May I add, though, that if the change to remove |
I wonder if it makes sense for this library to have a "sensible defaults" namespace, which adds enhanced validation that probably makes sense for the average project. This saves people from reinventing the wheel (possibly dangerously), while still allowing users to use the weaker spec compliant validations if they want. |
@danielcompton I thought about a declarative mechanism for rules like the ones @metametadata mentioned ("iat < now", "iat < nbf", "nbf < exp", etc.), "clock skew leeway = X seconds", but we are dealing with a lisp library and composable functions is the way to go. There could be built-in functions the library provides that do those checks (to not dangerously reinvent the wheel) but it would be up to the library user to provide an "additional validations" function that uses each of them. |
ps @funcool this is a really good library, thanks for the great work! |
I have readed twice this discussion and this one: jpadilla/pyjwt#190 and finally I have decided that i'm going to merge this. RFC is clear about this, if you want this functionality |
Partially addresses #39.