https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44007
--- Comment #2 from David Nind <[email protected]> --- Created attachment 210805 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210805&action=edit Bug 44007: Limit attempts and resends on the two-factor authentication second step The second step of the staff login accepted any number of wrong codes, and codes could be requested by email repeatedly. This patch: - counts wrong codes per login session and, after 5, discards the session so a new login is required. The login screen says why, and the failure is logged when AuthFailureLog is enabled. - refuses to send another code by email for 60 seconds after one was sent in the same session, for both the login fallback and the email enrolment (HTTP 429 too_many_requests). The cooldown only starts once a code was actually sent, so a failed send can be retried. The limits are constants in Koha::Auth::TwoFactorAuth. The validity window of emailed codes (global mfa_range) is not changed. To test: 1. Apply the patch (and Bug 44005 and Bug 44006), restart_all. 2. Enable TwoFactorAuthentication and TwoFactorAuthenticationEmailFallback and enrol a staff user. 3. Log in, and at the second step enter wrong codes: after the 5th you are returned to the login form with "Too many invalid two-factor codes. Please log in again." 4. Log in again: a correct code still works. 5. At the second step press "Send the code by email" twice in a row: the second is refused with a "please wait" message, and works again after a minute. 6. Repeat the second check for the email choice when enrolling. 7. prove t/db_dependent/Auth.t t/db_dependent/api/v1/two_factor_auth.t Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: David Nind <[email protected]> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
