aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2025-05-13 19:08:14 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2025-05-14 12:23:40 +0200
commita53e15c971e41a30bf1048cfdf7c048b0664a966 (patch)
tree8514f1db2dcc3961f9f6fa55df60f505a5fc4c08 /lib
parent1950076ca1f4f87cb363577d85c188c07ab934cf (diff)
downloadnextcloud-server-a53e15c971e41a30bf1048cfdf7c048b0664a966.tar.gz
nextcloud-server-a53e15c971e41a30bf1048cfdf7c048b0664a966.zip
fix: log requests exceeding the rate limitingbug/noid/log-requests-exceeding-rate-limit
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Security/RateLimiting/Limiter.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/Security/RateLimiting/Limiter.php b/lib/private/Security/RateLimiting/Limiter.php
index b7ac26d9132..316becfa009 100644
--- a/lib/private/Security/RateLimiting/Limiter.php
+++ b/lib/private/Security/RateLimiting/Limiter.php
@@ -13,10 +13,12 @@ use OC\Security\RateLimiting\Backend\IBackend;
use OC\Security\RateLimiting\Exception\RateLimitExceededException;
use OCP\IUser;
use OCP\Security\RateLimiting\ILimiter;
+use Psr\Log\LoggerInterface;
class Limiter implements ILimiter {
public function __construct(
private IBackend $backend,
+ private LoggerInterface $logger,
) {
}
@@ -32,6 +34,11 @@ class Limiter implements ILimiter {
): void {
$existingAttempts = $this->backend->getAttempts($methodIdentifier, $userIdentifier);
if ($existingAttempts >= $limit) {
+ $this->logger->info('Request blocked because it exceeds the rate limit [method: {method}, limit: {limit}, period: {period}]', [
+ 'method' => $methodIdentifier,
+ 'limit' => $limit,
+ 'period' => $period,
+ ]);
throw new RateLimitExceededException();
}