@@ -147,9 +147,6 @@ public function test_ip_matches(string $ip, string $ipOrRange, bool $expected):
147147 */
148148 public function proxy_is_trusted_provider (): array
149149 {
150- // The default value that shipped with the config.
151- $ legacyDefault = '^(::1|[fF][eE]80:|127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.) ' ;
152-
153150 // The new default configuration value.
154151 $ default = ['::1 ' , 'fe80::/10 ' , '127.0.0.0/8 ' , '10.0.0.0/8 ' , '172.16.0.0/12 ' , '192.168.0.0/16 ' ];
155152
@@ -160,20 +157,6 @@ public function proxy_is_trusted_provider(): array
160157 // Empty configuration.
161158 ['' , '127.0.0.1 ' , false ],
162159
163- // Legacy configuration with a regular expression.
164- [$ legacyDefault , '127.0.0.1 ' , true ],
165- [$ legacyDefault , '127.1.2.3 ' , true ],
166- [$ legacyDefault , '10.1.2.3 ' , true ],
167- [$ legacyDefault , '11.1.2.3 ' , false ],
168- [$ legacyDefault , '172.16.0.1 ' , true ],
169- [$ legacyDefault , '172.160.0.1 ' , false ],
170- [$ legacyDefault , '172.31.255.255 ' , true ],
171- [$ legacyDefault , '172.32.0.0 ' , false ],
172- [$ legacyDefault , '172.200.0.0 ' , false ],
173- [$ legacyDefault , '192.168.2.3 ' , true ],
174- [$ legacyDefault , '192.169.1.2 ' , false ],
175- [$ legacyDefault , '::1 ' , true ],
176-
177160 // Configuration with an array of IPs/CIDRs.
178161 [$ default , '127.0.0.1 ' , true ],
179162 [$ default , '127.1.2.3 ' , true ],
@@ -230,9 +213,6 @@ public function test_proxy_is_trusted($config, string $ip, bool $expected): void
230213 */
231214 public function forwarded_for_provider (): array
232215 {
233- // The default value that shipped with the config.
234- $ legacyDefault = '^(::1|[fF][eE]80:|127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.) ' ;
235-
236216 // The new default configuration value.
237217 $ default = ['::1 ' , 'fe80::/10 ' , '127.0.0.0/8 ' , '10.0.0.0/8 ' , '172.16.0.0/12 ' , '192.168.0.0/16 ' ];
238218
@@ -241,27 +221,9 @@ public function forwarded_for_provider(): array
241221
242222 $ tests = [
243223 // Empty config value should always return empty array.
244- ['' , '' , '127.0.0.1 ' , []],
245- ['' , '127.0.0.1 ' , '127.0.0.1 ' , []],
246224 [[], '' , '127.0.0.1 ' , []],
247225 [[], '127.0.0.1 ' , '127.0.0.1 ' , []],
248226
249- // The old default configuration.
250- [$ legacyDefault , '' , '127.0.0.1 ' , []],
251- [$ legacyDefault , '1.2.3.4 ' , '127.0.0.1 ' , ['1.2.3.4 ' , '127.0.0.1 ' ]],
252- [$ legacyDefault , '1.2.3.4 ' , '192.168.1.1 ' , ['1.2.3.4 ' , '192.168.1.1 ' ]],
253- [$ legacyDefault , '1.2.3.4,172.16.0.1 ' , '192.168.1.1 ' , ['1.2.3.4 ' , '172.16.0.1 ' , '192.168.1.1 ' ]],
254- [$ legacyDefault , '1.2.3.4,172.16.0.1 ' , '::1 ' , ['1.2.3.4 ' , '172.16.0.1 ' , '::1 ' ]],
255-
256- // Directly from an untrusted proxy.
257- [$ legacyDefault , '' , '127.0.0.1 ' , []],
258- [$ legacyDefault , '1.2.3.4 ' , '11.22.33.44 ' , []],
259- [$ legacyDefault , '::1 ' , '11.22.33.44 ' , []],
260-
261- // From a trusted proxy, but via an untrusted proxy.
262- [$ legacyDefault , '1.2.3.4,11.22.33.44,172.16.0.1 ' , '192.168.1.1 ' , []],
263- [$ legacyDefault , '1.2.3.4,::2,172.16.0.1 ' , '::1 ' , []],
264-
265227 // The new default configuration.
266228 [$ default , '' , '127.0.0.1 ' , []],
267229 [$ default , '1.2.3.4 ' , '127.0.0.1 ' , ['1.2.3.4 ' , '127.0.0.1 ' ]],
0 commit comments