RFC: Rate limiting / throttling support #882
maximelebastard
started this conversation in
Ideas
Replies: 1 comment
-
In my opinion Lucia shouldn't handle throttling as it is out of scope for what lucia is. Throttling should be done outside of Lucia, ideally at the beginning of the requests, for example: function login() {
-- throttle logic here
-- lucia stuff here
}
function callback() {
-- throttle logic here
-- lucia stuff here
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Lucia currently allows an unlimited amount of login attempts for an account. That means it is your responsibility (typically using a WAF or a middleware) to limit the login attempts that can be made on a user account. This could be tricky to configure, and it often does not offer a satisfying fine-grain monitoring and control when it is done at an infrastructure level.
Potentially new concept added
A new Attempt model may be added in Lucia to represent a failed attempt of access to an account. It would be linked to a Key and not directly to the User.
Attempts counting
When trying to sign in, the counting of previous attempts could take two forms:
Mitigation method
When the maximum number of attempts is reached, we could provide two ways to block an attacker:
Attempts would be stored in your database using the existing adapters. Attempts would have a time-to-live (1 month by default). Outdated attempts are automatically cleaned.
New options
The following new options could be provided to setup the rate limiting
Evolution of the login process
The login process would call two new methods
checkAttempt
before any password check - andregisterAttempt
for any failed attempt.A new error
AUTH_TOO_MANY_ATTEMPTS
would be thrown in case of unsuccessfulcheckAttempts
This RFC follows the draft #881
Beta Was this translation helpful? Give feedback.
All reactions