diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-03-03 16:22:30 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-03-03 21:24:00 -0800 |
commit | 93422af5d5bc0285bd72cfb2fd9b59f6d64ba141 (patch) | |
tree | 10416ad8d3ba611fb8fcb7191decb7580f126db2 /actionpack/lib/action_dispatch/middleware/block_untrusted_ips.rb | |
parent | 9a9caf646d020e33ccdeac0f9b114acec019b599 (diff) | |
download | rails-93422af5d5bc0285bd72cfb2fd9b59f6d64ba141.tar.gz rails-93422af5d5bc0285bd72cfb2fd9b59f6d64ba141.tar.bz2 rails-93422af5d5bc0285bd72cfb2fd9b59f6d64ba141.zip |
Move remote_ip to a middleware:
* ActionController::Base.ip_spoofing_check deprecated => config.action_dispatch.ip_spoofing_check
* ActionController::Base.trusted_proxies deprecated => config.action_dispatch.trusted_proxies
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/block_untrusted_ips.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/block_untrusted_ips.rb | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/block_untrusted_ips.rb b/actionpack/lib/action_dispatch/middleware/block_untrusted_ips.rb deleted file mode 100644 index 8aed0c45a6..0000000000 --- a/actionpack/lib/action_dispatch/middleware/block_untrusted_ips.rb +++ /dev/null @@ -1,25 +0,0 @@ -module ActionDispatch - class BlockUntrustedIps - class SpoofAttackError < StandardError ; end - - def initialize(app) - @app = app - end - - def call(env) - if @env['HTTP_X_FORWARDED_FOR'] && @env['HTTP_CLIENT_IP'] - remote_ips = @env['HTTP_X_FORWARDED_FOR'].split(',') - - unless remote_ips.include?(@env['HTTP_CLIENT_IP']) - http_client_ip = @env['HTTP_CLIENT_IP'].inspect - http_forwarded_for = @env['HTTP_X_FORWARDED_FOR'].inspect - - raise SpoofAttackError, "IP spoofing attack?!\n " \ - "HTTP_CLIENT_IP=#{http_client_ip}\n HTTP_X_FORWARDED_FOR=http_forwarded_for" - end - end - - @app.call(env) - end - end -end
\ No newline at end of file |