Permalink
Browse files

Add regression test for IpSpoofAttackError issue

See #10780
  • Loading branch information...
1 parent 8436620 commit 228d2b1e935583f0c5bd64227ff157c346cbbb3d @aredondo aredondo committed Sep 3, 2013
Showing with 8 additions and 0 deletions.
  1. +8 −0 actionpack/test/dispatch/request_test.rb
@@ -93,6 +93,14 @@ def url_for(options = {})
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

0 comments on commit 228d2b1

Please sign in to comment.