diff options
author | Joas Schilling <coding@schilljs.com> | 2023-08-14 18:59:50 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-08-23 06:44:06 +0200 |
commit | 97548e789fd09685d79ad4bf28c59d7067ca55b4 (patch) | |
tree | 864b1dff6eebd279966d29a8c6c76f7701e50d3d /lib/private/Security | |
parent | befa2f6d51231c9f79f4c66457424870c120517a (diff) | |
download | nextcloud-server-97548e789fd09685d79ad4bf28c59d7067ca55b4.tar.gz nextcloud-server-97548e789fd09685d79ad4bf28c59d7067ca55b4.zip |
feat(security): Add a "testing mode" for bruteforce protection that doesn't sleep
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Security')
-rw-r--r-- | lib/private/Security/Bruteforce/Throttler.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index a0a41a8b4c4..01032c415ff 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -280,7 +280,9 @@ class Throttler implements IThrottler { */ public function sleepDelay(string $ip, string $action = ''): int { $delay = $this->getDelay($ip, $action); - usleep($delay * 1000); + if (!$this->config->getSystemValueBool('auth.bruteforce.protection.testing')) { + usleep($delay * 1000); + } return $delay; } @@ -304,7 +306,9 @@ class Throttler implements IThrottler { 'delay' => $delay, ]); } - usleep($delay * 1000); + if (!$this->config->getSystemValueBool('auth.bruteforce.protection.testing')) { + usleep($delay * 1000); + } return $delay; } } |