Skip to content

Commit

Permalink
Fix issue with attr_protected where malformed input could circumvent
Browse files Browse the repository at this point in the history
protection

Fixes: CVE-2013-0276
  • Loading branch information
joernchen authored and zzak committed Jul 4, 2023
1 parent d76f2de commit 41a998e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activemodel/lib/active_model/attribute_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def initialize(prefix: "", suffix: "", parameters: nil)
@prefix = prefix
@suffix = suffix
@parameters = parameters.nil? ? FORWARD_PARAMETERS : parameters
@regex = /^(?:#{Regexp.escape(@prefix)})(.*)(?:#{Regexp.escape(@suffix)})$/
@regex = /\A(?:#{Regexp.escape(@prefix)})(.*)(?:#{Regexp.escape(@suffix)})\z/
@target = "#{@prefix}attribute#{@suffix}"
@method_name = "#{prefix}%s#{suffix}"
end
Expand Down

0 comments on commit 41a998e

Please sign in to comment.