Make it an error if address is not known and we are not in CLI

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/41438/head
Côme Chilliet 2023-11-20 15:52:28 +07:00
parent f47a2bbcae
commit f023216cf4
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
2 changed files with 14 additions and 5 deletions

@ -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),

@ -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') !== '') {