Browse files

Clean tag attributes before passing through the escape_once logic.

Addresses CVE-2009-3009
  • Loading branch information...
1 parent 9c61eb3 commit 31678df21276f0a986a4e39a69a4c10a2236a2ce @NZKoz NZKoz committed Aug 31, 2009
Showing with 1 addition and 1 deletion.
  1. +1 −1 actionpack/lib/action_view/helpers/tag_helper.rb
View
2 actionpack/lib/action_view/helpers/tag_helper.rb
@@ -104,7 +104,7 @@ def cdata_section(content)
# escape_once("<< Accept & Checkout")
# # => "<< Accept & Checkout"
def escape_once(html)
- html.to_s.gsub(/[\"><]|&(?!([a-zA-Z]+|(#\d+));)/) { |special| ERB::Util::HTML_ESCAPE[special] }
+ ActiveSupport::Multibyte.clean(html.to_s).gsub(/[\"><]|&(?!([a-zA-Z]+|(#\d+));)/) { |special| ERB::Util::HTML_ESCAPE[special] }
end
private

0 comments on commit 31678df

Please sign in to comment.