-
Notifications
You must be signed in to change notification settings - Fork 11.4k
[5.2] dont increment login attempt if the user is locked out #12037
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
Conversation
Surely this isn't correct? |
If someone attempts, the attempt could should increment. The fact that this fixes the other bug may be true, but it introduces another bug. |
This bug (#11967) would be especially troublesome with lower rate limiting thresholds (around 3 or so). I don't see another solution based on how the RateLimiter class increments. We would need to change that to a rate limit "session" which increments to the same instance even after lockout. |
[5.2] dont increment login attempt if the user is locked out
Not to resurrect a four-month old issue, but the original bug (#11967) still persists. Furthermore, I believe the changes merged here don't work as intended. From what I understand, the issue lies with the RateLimiter's decay value being represented in minutes, whereas the ThrottlesLogins trait determines lockouts in seconds. Additionally, ThrottlesLogins does not allow for the RateLimiter's decay value to be passed along, meaning the RateLimiter's default value of The bug seems to happen whenever the specified lockout time is less than that one-minute default, as the RateLimiter's cache sticks around longer than the user is denied access. In that small window of time, between the lockout lifting and the cache expiring, ThrottlesLogins will see the still-active failure count and immediately lock the user out again. Only when the user waits a full minute from when they were locked out does that count expire. I would attempt to fix this and send a PR; however, the changes needed, while minor, go as deep as the Cache Stores, which send decay durations of |
What if when the lockout flag is added we reset the login attempt count? Then further requests while locked out would't increment the count at all. Once that lockout expires you would already have the reset counter to try again... Thoughts? |
Yes, I believe that would work. |
Ok, I didn't look at the actual code before commenting that but I'm glad it sounded sane :) I'll look into it and submit a PR unless you want to do it yourself? |
Nevermind, it was an easy fix. Pushing PR now. |
Cool. In fact, in the $this->resetAttempts($key.':lockout'); |
eh, i think that should stay as it is because its not really resetting an attempt, its removing the :lockout key |
I do have a further point of concern. I would put this in a separate issue, but it's really part of the same discussion. The My opinion is that |
Yeah I would raise that in a separate issue and see what Taylor thinks. I don't think an extra call to |
Alright, I'll do that. Thanks! |
This commit makes no sense. If |
I agree. That's what I meant above when I said "the changes merged here don't work as intended". However, I believe the original issue is now fixed as the follow-up PR to this was merged recently. |
fixes #11967