Nbdd0121 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/283115

Change subject: Make IP.php trust X-Forwarded-For supplied by $wgSquidServers 
with port
......................................................................

Make IP.php trust X-Forwarded-For supplied by $wgSquidServers with port

Bug: T132538
Change-Id: Icee885e8a282367fda9c501067179121721f7529
---
M includes/utils/IP.php
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/283115/1

diff --git a/includes/utils/IP.php b/includes/utils/IP.php
index 4a2205e..375b1fe 100644
--- a/includes/utils/IP.php
+++ b/includes/utils/IP.php
@@ -751,6 +751,16 @@
                // Quick check of known singular proxy servers
                $trusted = in_array( $ip, $wgSquidServers );
 
+               // Check known singular proxy servers with ports
+               $ipWithColon = $ip . ':';
+               $ipWithColonLen = strlen( $ipWithColon );
+               foreach ( $wgSquidServers as $server ) {
+                       if ( !strncmp( $ipWithColon, $server, $ipWithColonLen ) 
) {
+                               $trusted = true;
+                               break;
+                       }
+               }
+
                // Check against addresses and CIDR nets in the NoPurge list
                if ( !$trusted ) {
                        if ( !self::$proxyIpSet ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/283115
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icee885e8a282367fda9c501067179121721f7529
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nbdd0121 <nbdd0...@hotmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to