Navigation Menu

Skip to content

Commit

Permalink
adding test for CVE
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Feb 10, 2013
1 parent 647afdb commit b0bf30c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions activerecord/test/cases/mass_assignment_security_test.rb
Expand Up @@ -287,6 +287,16 @@ def test_find_or_create_by_with_admin_role_with_attr_protected_attributes
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


Expand Down

0 comments on commit b0bf30c

Please sign in to comment.