aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/request
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2013-11-30 16:45:23 +1300
committerAaron Patterson <aaron.patterson@gmail.com>2013-12-02 16:44:27 -0800
commit4e9dd5378bd5bfaa095a96068c7d1b7c4f47e1b0 (patch)
treeba544df1b4a7b4794a833bf52a3e081884045edf /actionpack/test/dispatch/request
parent0c7ac34aed1845044cd1911e5a775366d7ca41c1 (diff)
downloadrails-4e9dd5378bd5bfaa095a96068c7d1b7c4f47e1b0.tar.gz
rails-4e9dd5378bd5bfaa095a96068c7d1b7c4f47e1b0.tar.bz2
rails-4e9dd5378bd5bfaa095a96068c7d1b7c4f47e1b0.zip
Deep Munge the parameters for GET and POST
The previous implementation of this functionality could be accidentally subverted by instantiating a raw Rack::Request before the first Rails::Request was constructed. Fixes CVE-2013-6417
Diffstat (limited to 'actionpack/test/dispatch/request')
-rw-r--r--actionpack/test/dispatch/request/query_string_parsing_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request/query_string_parsing_test.rb b/actionpack/test/dispatch/request/query_string_parsing_test.rb
index f072a9f717..0ad0dbc958 100644
--- a/actionpack/test/dispatch/request/query_string_parsing_test.rb
+++ b/actionpack/test/dispatch/request/query_string_parsing_test.rb
@@ -11,6 +11,17 @@ class QueryStringParsingTest < ActionDispatch::IntegrationTest
head :ok
end
end
+ class EarlyParse
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ # Trigger a Rack parse so that env caches the query params
+ Rack::Request.new(env).params
+ @app.call(env)
+ end
+ end
def teardown
TestController.last_query_parameters = nil
@@ -131,6 +142,10 @@ class QueryStringParsingTest < ActionDispatch::IntegrationTest
set.draw do
get ':action', :to => ::QueryStringParsingTest::TestController
end
+ @app = self.class.build_app(set) do |middleware|
+ middleware.use(EarlyParse)
+ end
+
get "/parse", actual
assert_response :ok