diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-12-23 11:07:07 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-12-23 11:07:07 -0800 |
commit | 325669f0795a9148fd31f7f496a40dc8e114ef52 (patch) | |
tree | 12966d62810e5eca01b59f2916f22f804cd30d5e /activerecord/test | |
parent | 7d592ba3974321934db5d693273002bdd9668863 (diff) | |
download | rails-325669f0795a9148fd31f7f496a40dc8e114ef52.tar.gz rails-325669f0795a9148fd31f7f496a40dc8e114ef52.tar.bz2 rails-325669f0795a9148fd31f7f496a40dc8e114ef52.zip |
CVE-2012-5664 options hashes should only be extracted if there are extra parameters
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 5d72e35c60..77ca3b574d 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -15,6 +15,18 @@ require 'models/toy' class FinderTest < ActiveRecord::TestCase fixtures :companies, :topics, :entrants, :developers, :developers_projects, :posts, :comments, :accounts, :authors, :customers, :categories, :categorizations + def test_find_by_id_with_hash + assert_raises(ActiveRecord::StatementInvalid) do + Post.find_by_id(:limit => 1) + end + end + + def test_find_by_title_and_id_with_hash + assert_raises(ActiveRecord::StatementInvalid) do + Post.find_by_title_and_id('foo', :limit => 1) + end + end + def test_find assert_equal(topics(:first).title, Topic.find(1).title) end |