aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Security
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-08-16 17:40:38 +0200
committerJoas Schilling <coding@schilljs.com>2023-08-21 16:40:24 +0200
commit124588d4a64f518aef9270002e72c3604ddb3077 (patch)
tree6de1383e2ec21fb17fd9e908ab7638932617a681 /lib/private/Security
parentb2fd283a300d0c5b260d50bbf6ab7574b24dafe9 (diff)
downloadnextcloud-server-124588d4a64f518aef9270002e72c3604ddb3077.tar.gz
nextcloud-server-124588d4a64f518aef9270002e72c3604ddb3077.zip
fix: Make bypass function public API
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Security')
-rw-r--r--lib/private/Security/Bruteforce/Capabilities.php5
-rw-r--r--lib/private/Security/Bruteforce/Throttler.php10
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/private/Security/Bruteforce/Capabilities.php b/lib/private/Security/Bruteforce/Capabilities.php
index 4eada3d05f5..b50eea0b7af 100644
--- a/lib/private/Security/Bruteforce/Capabilities.php
+++ b/lib/private/Security/Bruteforce/Capabilities.php
@@ -32,11 +32,12 @@ namespace OC\Security\Bruteforce;
use OCP\Capabilities\IPublicCapability;
use OCP\Capabilities\IInitialStateExcludedCapability;
use OCP\IRequest;
+use OCP\Security\Bruteforce\IThrottler;
class Capabilities implements IPublicCapability, IInitialStateExcludedCapability {
public function __construct(
private IRequest $request,
- private Throttler $throttler,
+ private IThrottler $throttler,
) {
}
@@ -47,7 +48,7 @@ class Capabilities implements IPublicCapability, IInitialStateExcludedCapability
return [
'bruteforce' => [
'delay' => $this->throttler->getDelay($this->request->getRemoteAddress()),
- 'allow-listed' => $this->throttler->isIPWhitelisted($this->request->getRemoteAddress()),
+ 'allow-listed' => $this->throttler->isBypassListed($this->request->getRemoteAddress()),
],
];
}
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php
index 5c4f4d320b1..2803373e8ba 100644
--- a/lib/private/Security/Bruteforce/Throttler.php
+++ b/lib/private/Security/Bruteforce/Throttler.php
@@ -80,7 +80,7 @@ class Throttler implements IThrottler {
}
$ipAddress = new IpAddress($ip);
- if ($this->isIPWhitelisted((string)$ipAddress)) {
+ if ($this->isBypassListed((string)$ipAddress)) {
return;
}
@@ -110,7 +110,7 @@ class Throttler implements IThrottler {
* @param string $ip
* @return bool
*/
- public function isIPWhitelisted(string $ip): bool {
+ public function isBypassListed(string $ip): bool {
if (isset($this->ipIsWhitelisted[$ip])) {
return $this->ipIsWhitelisted[$ip];
}
@@ -200,7 +200,7 @@ class Throttler implements IThrottler {
}
$ipAddress = new IpAddress($ip);
- if ($this->isIPWhitelisted((string)$ipAddress)) {
+ if ($this->isBypassListed((string)$ipAddress)) {
return 0;
}
@@ -245,7 +245,7 @@ class Throttler implements IThrottler {
}
$ipAddress = new IpAddress($ip);
- if ($this->isIPWhitelisted((string)$ipAddress)) {
+ if ($this->isBypassListed((string)$ipAddress)) {
return;
}
@@ -268,7 +268,7 @@ class Throttler implements IThrottler {
}
$ipAddress = new IpAddress($ip);
- if ($this->isIPWhitelisted((string)$ipAddress)) {
+ if ($this->isBypassListed((string)$ipAddress)) {
return;
}