aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndrey Borysenko <andrey18106x@gmail.com>2024-07-11 13:18:03 +0300
committerAndrey Borysenko <andrey18106x@gmail.com>2024-07-18 17:16:57 +0300
commit40f820470a4ad1106207aca4583c8531c5a4a6c6 (patch)
treed52c708a94af7b3b4f5764a654d7e416f5c36c93 /lib
parent9cd2e5bed9c373ec204461648bf962cff82855b1 (diff)
downloadnextcloud-server-40f820470a4ad1106207aca4583c8531c5a4a6c6.tar.gz
nextcloud-server-40f820470a4ad1106207aca4583c8531c5a4a6c6.zip
chore: use "app_api" session key, "app_api_system" is deprecated
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php
index d593bf5019f..511ee3fc28a 100644
--- a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php
+++ b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php
@@ -11,6 +11,7 @@ namespace OC\AppFramework\Middleware\Security;
use OC\AppFramework\Utility\ControllerMethodReflector;
use OC\Security\RateLimiting\Exception\RateLimitExceededException;
use OC\Security\RateLimiting\Limiter;
+use OC\User\Session;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\AnonRateLimit;
use OCP\AppFramework\Http\Attribute\ARateLimit;
@@ -63,8 +64,8 @@ class RateLimitingMiddleware extends Middleware {
parent::beforeController($controller, $methodName);
$rateLimitIdentifier = get_class($controller) . '::' . $methodName;
- if ($this->session->exists('app_api_system')) {
- // Bypass rate limiting for app_api
+ if ($this->userSession instanceof Session && $this->userSession->getSession()->get('app_api') === true && $this->userSession->getUser() === null) {
+ // if userId is not specified and the request is authenticated by AppAPI, we skip the rate limit
return;
}