From e0774e47302a907319ed974ccf59b8b54d32bbde Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 16 Aug 2011 14:58:39 -0700 Subject: [PATCH] fixing utf8 escape vulerability --- .../lib/active_support/core_ext/string/output_safety.rb | 2 +- activesupport/test/core_ext/string_ext_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index 60f9fd25f5854..8e68ab0b429d9 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -19,7 +19,7 @@ def html_escape(s) if s.html_safe? s else - s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }.html_safe + s.to_s.gsub(/&/, "&").gsub(/\"/, """).gsub(/>/, ">").gsub(/