mirror of
https://github.com/Mailu/Mailu.git
synced 2025-04-15 11:47:04 +02:00
ratelimit: ensure we hit the ip-ratelimit on unsuccesful attempts
against a valid account
This commit is contained in:
parent
775033391a
commit
21ed7b69a8
@ -71,6 +71,7 @@ class LimitWraperFactory(object):
|
||||
def rate_limit_user(self, username, ip, device_cookie=None, device_cookie_name=None, password=''):
|
||||
limiter = self.get_limiter(app.config["AUTH_RATELIMIT_USER"], 'auth-user')
|
||||
if self.is_subject_to_rate_limits(ip):
|
||||
self.rate_limit_ip(ip, username)
|
||||
truncated_password = hmac.new(bytearray(username, 'utf-8'), bytearray(password, 'utf-8'), 'sha256').hexdigest()[-6:]
|
||||
if password and (self.storage.get(f'dedup2-{username}-{truncated_password}') > 0):
|
||||
return
|
||||
|
@ -1 +1,2 @@
|
||||
Always exempt login attempts that use app-tokens from rate-limits
|
||||
Ensure that unsuccessful login attempts against a valid account hit the ip-based rate-limit too
|
||||
|
Loading…
x
Reference in New Issue
Block a user