From ad372869bc803c3540fd8657c4fcb643d3db5b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 20 Nov 2023 18:03:15 +0100 Subject: [PATCH] Fix tests for setupchecks 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 | 4 ++-- apps/settings/lib/SetupChecks/ForwardedForHeaders.php | 2 +- apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/settings/lib/SetupChecks/BruteForceThrottler.php b/apps/settings/lib/SetupChecks/BruteForceThrottler.php index d5d6d42ccba..3fbdf2d788a 100644 --- a/apps/settings/lib/SetupChecks/BruteForceThrottler.php +++ b/apps/settings/lib/SetupChecks/BruteForceThrottler.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]) ); } } diff --git a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php index fda5f31cee1..3572feabb1f 100644 --- a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php +++ b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php @@ -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.'), diff --git a/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php b/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php index 9da2bccda79..bacc557490b 100644 --- a/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php +++ b/apps/settings/tests/SetupChecks/ForwardedForHeadersTest.php @@ -133,7 +133,7 @@ class ForwardedForHeadersTest extends TestCase { ->willReturn('1.1.1.1'); $this->assertEquals( - SetupResult::WARNING, + SetupResult::ERROR, $this->check->run()->getSeverity() ); }