diff options
author | Michael Koziarski <michael@koziarski.com> | 2013-11-30 16:45:23 +1300 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-12-02 14:14:35 -0800 |
commit | d5a4095ca5725d5eebcce153d7d0738375146cef (patch) | |
tree | 328632b6185b19991f7d86f67889fa42977197e0 /actionpack/test | |
parent | 78790e4bceedc632cb40f9597792d7e27234138a (diff) | |
download | rails-d5a4095ca5725d5eebcce153d7d0738375146cef.tar.gz rails-d5a4095ca5725d5eebcce153d7d0738375146cef.tar.bz2 rails-d5a4095ca5725d5eebcce153d7d0738375146cef.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
Conflicts:
actionpack/lib/action_dispatch/http/request.rb
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/request/query_string_parsing_test.rb | 15 |
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 bc0641e3a0..0cfa90af98 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 @@ -120,6 +131,10 @@ class QueryStringParsingTest < ActionDispatch::IntegrationTest set.draw do match ':action', :to => ::QueryStringParsingTest::TestController end + @app = self.class.build_app(set) do |middleware| + middleware.use(EarlyParse) + end + get "/parse", actual assert_response :ok |