aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2013-12-21 01:11:47 +0100
committerXavier Noria <fxn@hashref.com>2013-12-21 01:16:38 +0100
commit92f9ff8cc325d72d74cbf839ac9ac0acd474a768 (patch)
tree041cdcdcf7ed07f8efdd1574075f47716212fff8 /actionpack/test
parentfbb79b517f3127ba620fedd01849f9628b78d6ce (diff)
downloadrails-92f9ff8cc325d72d74cbf839ac9ac0acd474a768.tar.gz
rails-92f9ff8cc325d72d74cbf839ac9ac0acd474a768.tar.bz2
rails-92f9ff8cc325d72d74cbf839ac9ac0acd474a768.zip
converts hashes in arrays of unfiltered params to unpermitted params [fixes #13382]
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/parameters/parameters_permit_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/controller/parameters/parameters_permit_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb
index b60c5f058d..ba191a7227 100644
--- a/actionpack/test/controller/parameters/parameters_permit_test.rb
+++ b/actionpack/test/controller/parameters/parameters_permit_test.rb
@@ -153,6 +153,13 @@ class ParametersPermitTest < ActiveSupport::TestCase
assert_equal nil, params[:foo]
end
+ test 'hashes in array values get wrapped' do
+ params = ActionController::Parameters.new(foo: [{}, {}])
+ params[:foo].each do |hash|
+ assert !hash.permitted?
+ end
+ end
+
test "fetch doesnt raise ParameterMissing exception if there is a default" do
assert_equal "monkey", @params.fetch(:foo, "monkey")
assert_equal "monkey", @params.fetch(:foo) { "monkey" }