mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fix issue with attr_protected where malformed input could circumvent
protection Fixes: CVE-2013-0276 Conflicts: activemodel/lib/active_model/attribute_methods.rb activerecord/test/cases/mass_assignment_security_test.rb
This commit is contained in:
committed by
Aaron Patterson
parent
f93d046770
commit
2dfd51247f
@@ -347,7 +347,7 @@ module ActiveModel
|
||||
def initialize(options = {})
|
||||
options.symbolize_keys!
|
||||
@prefix, @suffix = options[:prefix] || '', options[:suffix] || ''
|
||||
@regex = /^(#{Regexp.escape(@prefix)})(.+?)(#{Regexp.escape(@suffix)})$/
|
||||
@regex = /\A(#{Regexp.escape(@prefix)})(.+?)(#{Regexp.escape(@suffix)})\z/
|
||||
end
|
||||
|
||||
def match(method_name)
|
||||
|
||||
@@ -17,7 +17,7 @@ module ActiveModel
|
||||
protected
|
||||
|
||||
def remove_multiparameter_id(key)
|
||||
key.to_s.gsub(/\(.+/, '')
|
||||
key.to_s.gsub(/\(.+/m, '')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user