-
Notifications
You must be signed in to change notification settings - Fork 153
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
Harden login nonces #473
Harden login nonces #473
Conversation
HMAC logic looks good to be, only change would be to fail hard If wp_json_encode returns false. The return type is string|false. Tokens not being deleted should be fixed ASAP. |
Doh, good catch, thanks! Fixed in 87fdce0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial feedback. Looks good overall!
I'm gonna go ahead and merge this since it seems like everything has been resolved. We can definitely iterate if anyone has any more thoughts though. |
This shortens the attack window, but should still be plenty of time for normal use.
This guarantees that the nonce can only be used by the user it was generated for, and that it can only be used within the same expiration window.
The test only verifies that failing to verify a nonce will delete the valid nonce. It doesn't test that a valid nonce can't be reused.
b153455
to
c129c05
Compare
I noticed a few comments on a closed PR and didn't want them to fall through the cracks:
It also looks like a valid nonce can be reused many times. IMO it should be deleted once it's been successfully used once. The unit test says that it checks for this, but actually checks that an invalid nonce deletes a valid one.I'd appreciate some extra eyes on this one to make sure everything with the HMAC is correct.