diff options
author | Andreas Gohr <andi@splitbrain.org> | 2025-01-09 16:33:07 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2025-01-09 16:33:07 +0100 |
commit | d5dd5d1b1d2bd9d3299e5d0114855dae264944df (patch) | |
tree | 6f3dbde7e5de52df27ece22cb407458967499f1a | |
parent | 2f828abfb5c80097dfa52bc797301aa0223c1b87 (diff) | |
download | dokuwiki-d5dd5d1b1d2bd9d3299e5d0114855dae264944df.tar.gz dokuwiki-d5dd5d1b1d2bd9d3299e5d0114855dae264944df.zip |
use renamed trustedproxies setting in tests
-rw-r--r-- | _test/tests/inc/Ip.test.php | 8 | ||||
-rw-r--r-- | _test/tests/inc/common_clientip.test.php | 6 | ||||
-rw-r--r-- | inc/common.php | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/_test/tests/inc/Ip.test.php b/_test/tests/inc/Ip.test.php index 4d84a77ec..0d16d47c2 100644 --- a/_test/tests/inc/Ip.test.php +++ b/_test/tests/inc/Ip.test.php @@ -209,14 +209,14 @@ class ip_test extends DokuWikiTest { * * @dataProvider proxy_is_trusted_provider * - * @param string|string[] $config The value for $conf[trustedproxy]. + * @param string|string[] $config The value for $conf[trustedproxies]. * @param string $ip The proxy IP to test. * @param bool $expected The expected result from proxyIsTrusted(). */ public function test_proxy_is_trusted($config, string $ip, bool $expected): void { global $conf; - $conf['trustedproxy'] = $config; + $conf['trustedproxies'] = $config; $result = Ip::proxyIsTrusted($ip); @@ -312,7 +312,7 @@ class ip_test extends DokuWikiTest { * * @dataProvider forwarded_for_provider * - * @param string|string[] $config The trustedproxy config value. + * @param string|string[] $config The trustedproxies config value. * @param string $header The X-Forwarded-For header value. * @param string $remoteAddr The TCP/IP peer address. * @param array $expected The expected result from forwardedFor(). @@ -324,7 +324,7 @@ class ip_test extends DokuWikiTest { /* @var Input $INPUT */ global $INPUT, $conf; - $conf['trustedproxy'] = $config; + $conf['trustedproxies'] = $config; $INPUT->server->set('HTTP_X_FORWARDED_FOR', $header); $INPUT->server->set('REMOTE_ADDR', $remoteAddr); diff --git a/_test/tests/inc/common_clientip.test.php b/_test/tests/inc/common_clientip.test.php index 4375ad921..6db11eb89 100644 --- a/_test/tests/inc/common_clientip.test.php +++ b/_test/tests/inc/common_clientip.test.php @@ -3,7 +3,7 @@ class common_clientIP_test extends DokuWikiTest { /** - * @var mixed[] $configs Possible values for $conf['trustedproxy']. + * @var mixed[] $configs Possible values for $conf['trustedproxies']. */ private $configs = [ '^(::1|[fF][eE]80:|127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.)', @@ -110,7 +110,7 @@ class common_clientIP_test extends DokuWikiTest { $conf['realip'] = $useRealIp; foreach ($this->configs as $config) { - $conf['trustedproxy'] = $config; + $conf['trustedproxies'] = $config; $this->assertEquals(str_replace(array_keys($addresses), array_values($addresses), $expected), clientIP($single)); } } @@ -146,7 +146,7 @@ class common_clientIP_test extends DokuWikiTest { $conf['realip'] = $useRealIp; foreach ($this->configs as $config) { - $conf['trustedproxy'] = $config; + $conf['trustedproxies'] = $config; $this->assertEquals(str_replace(array_keys($addresses), array_values($addresses), $expected), clientIP($single)); } } diff --git a/inc/common.php b/inc/common.php index 0db350fdf..e674b8097 100644 --- a/inc/common.php +++ b/inc/common.php @@ -784,14 +784,14 @@ function checkwordblock($text = '') * The IP is sourced from, in order of preference: * * - The X-Real-IP header if $conf[realip] is true. - * - The X-Forwarded-For header if all the proxies are trusted by $conf[trustedproxy]. + * - The X-Forwarded-For header if all the proxies are trusted by $conf[trustedproxies]. * - The TCP/IP connection remote address. * - 0.0.0.0 if all else fails. * * The 'realip' config value should only be set to true if the X-Real-IP header * is being added by the web server, otherwise it may be spoofed by the client. * - * The 'trustedproxy' setting must not allow any IP, otherwise the X-Forwarded-For + * The 'trustedproxies' setting must not allow any IP, otherwise the X-Forwarded-For * may be spoofed by the client. * * @param bool $single If set only a single IP is returned. |