mirror of
https://github.com/github/rails.git
synced 2026-01-09 14:48:01 -05:00
adding test for CVE
This commit is contained in:
@@ -300,6 +300,16 @@ class MassAssignmentSecurityTest < ActiveRecord::TestCase
|
||||
assert_admin_attributes(p, true)
|
||||
end
|
||||
|
||||
def test_attr_protected_with_newline
|
||||
p = LoosePerson.new
|
||||
assert_raises(ActiveRecord::UnknownAttributeError) do
|
||||
p.attributes = {"comments=\n"=>"hax"}
|
||||
end
|
||||
assert_nil p.comments, "Comments is meant to be attr_protected but I assigned it with attributes="
|
||||
p.attributes= {"comments(1)\n" => "hax"}
|
||||
assert_nil p.comments, "Comments is meant to be attr_protected but I assigned it with attributes="
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user