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/lib/active_record | |
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/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/dynamic_matchers.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb index b6b8e24436..f15d0b7611 100644 --- a/activerecord/lib/active_record/dynamic_matchers.rb +++ b/activerecord/lib/active_record/dynamic_matchers.rb @@ -40,7 +40,12 @@ module ActiveRecord METHOD send(method_id, *arguments) elsif match.finder? - options = arguments.extract_options! + options = if arguments.length > attribute_names.size + arguments.extract_options! + else + {} + end + relation = options.any? ? scoped(options) : scoped relation.send :find_by_attributes, match, attribute_names, *arguments, &block elsif match.instantiator? |