-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Request] Ignore invalid IP addresses sent by proxies #16736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -858,7 +858,8 @@ public function testGetClientIpsForwardedProvider() | |
// $expected $remoteAddr $httpForwarded $trustedProxies | ||
return array( | ||
array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', null), | ||
array(array('_gazonk'), '127.0.0.1', 'for="_gazonk"', array('127.0.0.1')), | ||
array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', array('127.0.0.1')), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test case is modified, but returning something different that an IP address here looks broken. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already have this test case. See line above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no trusted proxy on the previous test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, you're right. |
||
array(array('88.88.88.88'), '127.0.0.1', 'for="unknown" for=88.88.88.88', array('127.0.0.1')), | ||
array(array('88.88.88.88'), '127.0.0.1', 'for="88.88.88.88:80"', array('127.0.0.1')), | ||
array(array('192.0.2.60'), '::1', 'for=192.0.2.60;proto=http;by=203.0.113.43', array('::1')), | ||
array(array('2620:0:1cfe:face:b00c::3', '192.0.2.43'), '::1', 'for=192.0.2.43, for=2620:0:1cfe:face:b00c::3', array('::1')), | ||
|
@@ -914,6 +915,9 @@ public function testGetClientIpsProvider() | |
|
||
// client IP with port | ||
array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', array('127.0.0.1')), | ||
|
||
// invalid forwarded IP is ignored | ||
array(array('88.88.88.88'), '127.0.0.1', 'unknown,88.88.88.88', array('127.0.0.1')), | ||
); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't this now be able to return
array(null)
in some cases though ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GromNaN Any thoughts about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the REMOTE_ADDR header contains an invalid IP address maybe.