aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-12-02 16:23:45 -0800
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-12-02 16:23:45 -0800
commit45f70dca7bbd822604941d0486e4a120882afcde (patch)
treeb3a5f0af14a40f1654d42a7a22339d5d9a0808fe /actionpack/test/dispatch
parentb42d4c407dcaf7ed1621d081aff1dcb1855b22e2 (diff)
parent228d2b1e935583f0c5bd64227ff157c346cbbb3d (diff)
downloadrails-45f70dca7bbd822604941d0486e4a120882afcde.tar.gz
rails-45f70dca7bbd822604941d0486e4a120882afcde.tar.bz2
rails-45f70dca7bbd822604941d0486e4a120882afcde.zip
Merge pull request #12123 from aredondo/master
Add regression test for IpSpoofAttackError issue Closes #10780
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r--actionpack/test/dispatch/request_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index f6de9748ca..9c7789bcfb 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -93,6 +93,14 @@ class RequestTest < ActiveSupport::TestCase
assert_equal '1.1.1.1', request.remote_ip
end
+ test "remote ip spoof protection ignores private addresses" do
+ request = stub_request 'HTTP_X_FORWARDED_FOR' => '172.17.19.51',
+ 'HTTP_CLIENT_IP' => '172.17.19.51',
+ 'REMOTE_ADDR' => '1.1.1.1',
+ 'HTTP_X_BLUECOAT_VIA' => 'de462e07a2db325e'
+ assert_equal '1.1.1.1', request.remote_ip
+ end
+
test "remote ip v6" do
request = stub_request 'REMOTE_ADDR' => '2001:0db8:85a3:0000:0000:8a2e:0370:7334'
assert_equal '2001:0db8:85a3:0000:0000:8a2e:0370:7334', request.remote_ip