Fix tests for setupchecks

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/41438/head
Côme Chilliet 2 years ago
parent 1f4e0927ba
commit ad372869bc
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
  1. 4
      apps/settings/lib/SetupChecks/BruteForceThrottler.php
  2. 2
      apps/settings/lib/SetupChecks/ForwardedForHeaders.php
  3. 2
      apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php

@ -62,12 +62,12 @@ class BruteForceThrottler implements ISetupCheck {
}
} 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),
$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]),
$this->urlGenerator->linkToDocs('admin-reverse-proxy')
);
} else {
return SetupResult::success(
$this->l10n->t('Your remote address "%s" is not bruteforce throttled.', $address)
$this->l10n->t('Your remote address "%s" is not bruteforce throttled.', [$address])
);
}
}

@ -79,7 +79,7 @@ class ForwardedForHeaders implements ISetupCheck {
if (\in_array($remoteAddress, $trustedProxies, true) && ($remoteAddress !== '127.0.0.1')) {
if ($remoteAddress !== $detectedRemoteAddress) {
/* Remote address was successfuly fixed */
return SetupResult::success($this->l10n->t('Your IP address was resolved as %s', $detectedRemoteAddress));
return SetupResult::success($this->l10n->t('Your IP address was resolved as %s', [$detectedRemoteAddress]));
} else {
return SetupResult::warning(
$this->l10n->t('The reverse proxy header configuration is incorrect, or you are accessing Nextcloud from a trusted proxy. If not, this is a security issue and can allow an attacker to spoof their IP address as visible to the Nextcloud.'),

@ -133,7 +133,7 @@ class ForwardedForHeadersTest extends TestCase {
->willReturn('1.1.1.1');
$this->assertEquals(
SetupResult::WARNING,
SetupResult::ERROR,
$this->check->run()->getSeverity()
);
}

Loading…
Cancel
Save