mirror of
https://github.com/antonioribeiro/google2fa.git
synced 2026-04-25 08:05:49 +03:00
[GH-ISSUE #69] verifyKeyNewer checks "newer or equal" instead of "strictly newer" #499
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/google2fa#499
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SebastianS90 on GitHub (Jun 21, 2017).
Original GitHub issue: https://github.com/antonioribeiro/google2fa/issues/69
First of all, thank you so much for merging and improving my PR (#50)!
But are you sure that this change in the specification is correct?
For me it looks wrong, especially when looking at the example from the readme file:
There we store the returned timestamp into the user model, and take it from there for the next
verifyKeyNewercall. The comparison therefore must be "strictly newer" and not "newer or equal".With your change, the situation is as follows (assuming that timestamp
26213401is in the window):410272which is for the timestamp26213401. Assume that this timestamp is new, i.e. the check will pass.verifyKeyNewercall returns26213401, we store that timestamp into the user model.410272.$google2fa->verifyKeyNewer($user->google2fa_secret, 410272, 26213401), which returns26213401as specified by your changed test.To resolve this, we either can:
->shouldBe(false)again and make sure that the implementation passes this test, or$user->update(['google2fa_ts' => $timestamp + 1]);(but this sounds less convenient)I might be wrong, as I haven't yet found the time to thoroughly test your new version, but the changed test feels wrong for me.
Anyways, thanks a lot for the effort you put into maintaining this package and further improving it for Laravel 5.5.
@antonioribeiro commented on GitHub (Jun 21, 2017):
Yeah, looking at the point of view of an attacker, you are right. So I just moved it back to +1 and tagged 2.0.1.
Thank you.