aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Security/Bruteforce
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-08-14 18:59:50 +0200
committerJoas Schilling <coding@schilljs.com>2023-08-21 16:36:03 +0200
commitabc98d343cbd43283eee02886c3a89bd3328ed38 (patch)
tree8f25a9cad5598f59193849c4d32673b5dd609e0f /lib/private/Security/Bruteforce
parenta95800c647dbb91c68a545a5378f169a6abd65cc (diff)
downloadnextcloud-server-abc98d343cbd43283eee02886c3a89bd3328ed38.tar.gz
nextcloud-server-abc98d343cbd43283eee02886c3a89bd3328ed38.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/Bruteforce')
-rw-r--r--lib/private/Security/Bruteforce/Throttler.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php
index cfd88801fcf..2ee4c23cd1e 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;
}
}