aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
authorGrey Baker <greysteil@gmail.com>2015-10-18 19:27:54 +0100
committerGrey Baker <greysteil@gmail.com>2015-10-23 14:56:47 +0100
commit59ab2d1ee5995d9ea27ca60e92576518c1898c59 (patch)
tree5bbae87d4879f32c6914607d261a05bcdef7a77a /actionpack/test/dispatch
parent6f62ace65a720f515da82f5fc5f3e7eab1df8658 (diff)
downloadrails-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.rb16
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