Permalink
Browse files

Deprecate IP spoofing settings that are directly on the controller in…

… favor of configuring a middleware
  • Loading branch information...
1 parent 52efbdc commit 786724107c3dedaeccaae9e187458b48df472f90 Carlhuda committed with Carl Lerche Mar 4, 2010
@@ -57,11 +57,6 @@ def self.use_accept_header=(val)
# and images to a dedicated asset server away from the main web server. Example:
# ActionController::Base.asset_host = "http://assets.example.com"
cattr_accessor :asset_host
-
- cattr_accessor :ip_spoofing_check
- self.ip_spoofing_check = true
-
- cattr_accessor :trusted_proxies
end
def self.deprecated_config_accessor(option, message = nil)
@@ -119,7 +114,7 @@ def consider_all_requests_local
end
def consider_all_requests_local=(value)
- ActiveSupport::Deprecation.warn "ActionController::Base.consider_all_requests_local= is no longer effective. " <<
+ ActiveSupport::Deprecation.warn "ActionController::Base.consider_all_requests_local= is deprecated. " <<
"Please configure it on your application with config.consider_all_requests_local="
Rails.application.config.consider_all_requests_local = value
end
@@ -131,11 +126,35 @@ def allow_concurrency
end
def allow_concurrency=(value)
- ActiveSupport::Deprecation.warn "ActionController::Base.allow_concurrency= is no longer effective. " <<
+ ActiveSupport::Deprecation.warn "ActionController::Base.allow_concurrency= is deprecated. " <<
"Please configure it on your application with config.allow_concurrency="
Rails.application.config.allow_concurrency = value
end
+ def ip_spoofing_check=(value)
+ ActiveSupport::Deprecation.warn "ActionController::Base.ip_spoofing_check= is deprecated. " <<
+ "Please configure it on your application with config.action_dispatch.ip_spoofing_check="
+ Rails.application.config.action_disaptch.ip_spoofing_check = value
+ end
+
+ def ip_spoofing_check
+ ActiveSupport::Deprecation.warn "ActionController::Base.ip_spoofing_check is deprecated. "
+ "Configuring ip_spoofing_check on the application configures a middleware."
+ Rails.application.config.action_disaptch.ip_spoofing_check
+ end
+
+ def trusted_proxies=(value)
+ ActiveSupport::Deprecation.warn "ActionController::Base.trusted_proxies= is deprecated. " <<
+ "Please configure it on your application with config.action_dispatch.trusted_proxies="
+ Rails.application.config.action_dispatch.ip_spoofing_check = value
+ end
+
+ def trusted_proxies
+ ActiveSupport::Deprecation.warn "ActionController::Base.trusted_proxies is deprecated. " <<
+ "Configuring trusted_proxies on the application configures a middleware."
+ Rails.application.config.action_dispatch.ip_spoofing_check = value
+ end
+
def rescue_action(env)
raise env["action_dispatch.rescue.exception"]
end
@@ -87,8 +87,6 @@ class RequestTest < ActiveSupport::TestCase
request = stub_request 'HTTP_X_FORWARDED_FOR' => '9.9.9.9, 3.4.5.6, 10.0.0.1, 67.205.106.73'
assert_equal '3.4.5.6', request.remote_ip
-
- ActionController::Base.trusted_proxies = nil
end
test "domains" do

0 comments on commit 7867241

Please sign in to comment.