diff options
author | Joas Schilling <coding@schilljs.com> | 2023-03-08 12:08:53 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-03-08 12:09:22 +0100 |
commit | 2b4986167975355238d982ba8579e0cccf6bf5aa (patch) | |
tree | 730917425cf1d4a6e943154f402c28708a2e8e4f /lib | |
parent | e839eb9b5c425a5ffd661798a72164204fe8e87d (diff) | |
download | nextcloud-server-2b4986167975355238d982ba8579e0cccf6bf5aa.tar.gz nextcloud-server-2b4986167975355238d982ba8579e0cccf6bf5aa.zip |
Add a debug message when throttling without defining
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/DependencyInjection/DIContainer.php | 3 | ||||
-rw-r--r-- | lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php | 19 |
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 9b202f07fbf..9a9740b7bcc 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -292,7 +292,8 @@ class DIContainer extends SimpleContainer implements IAppContainer { new OC\AppFramework\Middleware\Security\BruteForceMiddleware( $c->get(IControllerMethodReflector::class), $c->get(OC\Security\Bruteforce\Throttler::class), - $c->get(IRequest::class) + $c->get(IRequest::class), + $c->get(LoggerInterface::class) ) ); $dispatcher->registerMiddleware( diff --git a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php index ed43befd121..ba8c7f45b49 100644 --- a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php @@ -40,6 +40,7 @@ use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCSController; use OCP\IRequest; use OCP\Security\Bruteforce\MaxDelayReached; +use Psr\Log\LoggerInterface; use ReflectionMethod; /** @@ -50,16 +51,12 @@ use ReflectionMethod; * @package OC\AppFramework\Middleware\Security */ class BruteForceMiddleware extends Middleware { - private ControllerMethodReflector $reflector; - private Throttler $throttler; - private IRequest $request; - - public function __construct(ControllerMethodReflector $controllerMethodReflector, - Throttler $throttler, - IRequest $request) { - $this->reflector = $controllerMethodReflector; - $this->throttler = $throttler; - $this->request = $request; + public function __construct( + protected ControllerMethodReflector $reflector, + protected Throttler $throttler, + protected IRequest $request, + protected LoggerInterface $logger, + ) { } /** @@ -116,6 +113,8 @@ class BruteForceMiddleware extends Middleware { $this->throttler->registerAttempt($action, $ip, $metaData); } } + } else { + $this->logger->debug('Response for ' . get_class($controller) . '::' . $methodName . ' got bruteforce throttled but has no annotation nor attribute defined.'); } } } |