From f023216cf47ad2d6e69a16d69718d22e4d06ec2f Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Mon, 20 Nov 2023 15:52:28 +0100 Subject: Make it an error if address is not known and we are not in CLI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/settings/lib/SetupChecks/BruteForceThrottler.php | 10 +++++++--- apps/settings/lib/SetupChecks/ForwardedForHeaders.php | 9 +++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'apps/settings') diff --git a/apps/settings/lib/SetupChecks/BruteForceThrottler.php b/apps/settings/lib/SetupChecks/BruteForceThrottler.php index 6c1efd56bc1..88de5c2c82a 100644 --- a/apps/settings/lib/SetupChecks/BruteForceThrottler.php +++ b/apps/settings/lib/SetupChecks/BruteForceThrottler.php @@ -53,9 +53,13 @@ class BruteForceThrottler implements ISetupCheck { public function run(): SetupResult { $address = $this->request->getRemoteAddress(); if ($address === '') { - return SetupResult::info( - $this->l10n->t('Your remote address could not be determined.') - ); + if (\OC::$CLI) { + /* We were called from CLI */ + return SetupResult::info('Your remote address could not be determined.'); + } else { + /* Should never happen */ + return SetupResult::error('Your remote address could not be determined.'); + } } elseif ($this->throttler->showBruteforceWarning($address)) { return SetupResult::error( $this->l10n->t('Your remote address was identified as "%s" and is bruteforce throttled at the moment slowing down the performance of various requests. If the remote address is not your address this can be an indication that a proxy is not configured correctly.', $address), diff --git a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php index 5ba966f380b..47ff51ee05e 100644 --- a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php +++ b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php @@ -59,8 +59,13 @@ class ForwardedForHeaders implements ISetupCheck { } if (($remoteAddress === '') && ($this->request->getRemoteAddress() === '')) { - /* Most likely we were called from CLI */ - return SetupResult::info('Your remote address could not be determined.'); + if (\OC::$CLI) { + /* We were called from CLI */ + return SetupResult::info('Your remote address could not be determined.'); + } else { + /* Should never happen */ + return SetupResult::error('Your remote address could not be determined.'); + } } if (empty($trustedProxies) && $this->request->getHeader('X-Forwarded-Host') !== '') { -- cgit v1.2.3