Skip to content
Browse files

CVE-2012-5664 options hashes should only be extracted if there are ex…

…tra parameters

Conflicts:
	activerecord/lib/active_record/dynamic_matchers.rb
  • Loading branch information...
1 parent 8af6747 commit 44930b2def7fe9a6f3bc199bb3cd86c35ffbaba3 @tenderlove tenderlove committed Dec 23, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 activerecord/test/cases/finder_test.rb
View
12 activerecord/test/cases/finder_test.rb
@@ -15,6 +15,18 @@
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

0 comments on commit 44930b2

Please sign in to comment.
Something went wrong with that request. Please try again.