aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel <mail@danielkesselberg.de>2025-05-14 14:54:57 +0200
committerGitHub <noreply@github.com>2025-05-14 14:54:57 +0200
commit7523c38e5811faa5a10a50057842601923a084c3 (patch)
treeb9c8ad1042372ca534d5d6d88014f15ef77ba92b /lib
parent1c7e4a1ba6e512aadf515841e095d7ccb37d972c (diff)
parenta53e15c971e41a30bf1048cfdf7c048b0664a966 (diff)
downloadnextcloud-server-7523c38e5811faa5a10a50057842601923a084c3.tar.gz
nextcloud-server-7523c38e5811faa5a10a50057842601923a084c3.zip
Merge pull request #52798 from nextcloud/bug/noid/log-requests-exceeding-rate-limit
fix: log requests exceeding the rate limiting
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();
}