diff options
author | Grey Baker <greysteil@gmail.com> | 2015-10-18 19:27:54 +0100 |
---|---|---|
committer | Grey Baker <greysteil@gmail.com> | 2015-10-23 14:56:47 +0100 |
commit | 59ab2d1ee5995d9ea27ca60e92576518c1898c59 (patch) | |
tree | 5bbae87d4879f32c6914607d261a05bcdef7a77a /actionpack/test/dispatch | |
parent | 6f62ace65a720f515da82f5fc5f3e7eab1df8658 (diff) | |
download | rails-59ab2d1ee5995d9ea27ca60e92576518c1898c59.tar.gz rails-59ab2d1ee5995d9ea27ca60e92576518c1898c59.tar.bz2 rails-59ab2d1ee5995d9ea27ca60e92576518c1898c59.zip |
Catch invalid UTF-8 querystring values and respond with BadRequest
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/request_test.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index dfedc8ae25..e9896a71f4 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -977,13 +977,17 @@ class RequestParameters < BaseRequestTest test "parameters not accessible after rack parse error of invalid UTF8 character" do request = stub_request("QUERY_STRING" => "foo%81E=1") + assert_raises(ActionController::BadRequest) { request.parameters } + end - 2.times do - assert_raises(ActionController::BadRequest) do - # rack will raise a Rack::Utils::InvalidParameterError when parsing this query string - request.parameters - end - end + test "parameters containing an invalid UTF8 character" do + request = stub_request("QUERY_STRING" => "foo=%81E") + assert_raises(ActionController::BadRequest) { request.parameters } + end + + test "parameters containing a deeply nested invalid UTF8 character" do + request = stub_request("QUERY_STRING" => "foo[bar]=%81E") + assert_raises(ActionController::BadRequest) { request.parameters } end test "parameters not accessible after rack parse error 1" do |