From 8acc278b37d896c432f1e1b75fe23afe88c49ff8 Mon Sep 17 00:00:00 2001 From: Mamoru Tasaka Date: Dec 06 2009 16:57:21 +0000 Subject: - Fix for potential CSRF protection circumvention (bug 544329) - Fix for XSS weakness in strip_tags (bug 542786) --- diff --git a/rubygem-actionpack-2.1.x-verify-also-text.patch b/rubygem-actionpack-2.1.x-verify-also-text.patch new file mode 100644 index 0000000..08f3ef4 --- /dev/null +++ b/rubygem-actionpack-2.1.x-verify-also-text.patch @@ -0,0 +1,23 @@ +commit 099a98e9b7108dae3e0f78b207e0a7dc5913bd1a +Author: Michael Koziarski +Date: Sun Nov 16 20:35:25 2008 +0100 + + Verify form submissions for text/plain posts too. + + Some browsers can POST requests with text/plain encoding, allowing attackers to potentially subvert the request forgery prevention. + + http://pseudo-flaw.net/content/web-browsers/form-data-encoding-roundup/ + +diff --git a/actionpack/lib/action_controller/mime_type.rb b/actionpack/lib/action_controller/mime_type.rb +index fa123f7..453fc67 100644 +--- a/actionpack/lib/action_controller/mime_type.rb ++++ b/actionpack/lib/action_controller/mime_type.rb +@@ -18,7 +18,7 @@ module Mime + # end + class Type + @@html_types = Set.new [:html, :all] +- @@unverifiable_types = Set.new [:text, :json, :csv, :xml, :rss, :atom, :yaml] ++ @@unverifiable_types = Set.new [:json, :csv, :xml, :rss, :atom, :yaml] + cattr_reader :html_types, :unverifiable_types + + # A simple helper class used in parsing the accept header diff --git a/rubygem-actionpack-2.2.x-strip_tag-for-nonprintable.patch b/rubygem-actionpack-2.2.x-strip_tag-for-nonprintable.patch new file mode 100644 index 0000000..8656379 --- /dev/null +++ b/rubygem-actionpack-2.2.x-strip_tag-for-nonprintable.patch @@ -0,0 +1,35 @@ +From 785281ade8c2347614525e9aceb5e62c80eec6f8 Mon Sep 17 00:00:00 2001 +From: Gabe da Silveira +Date: Mon, 16 Nov 2009 21:17:35 -0800 +Subject: [PATCH] Make sure strip_tags removes tags which start with a non-printable character + +Signed-off-by: Michael Koziarski +--- + .../vendor/html-scanner/html/node.rb | 2 +- + 2 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb +index 6c03316..0cd05d8 100644 +--- a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb ++++ b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb +@@ -162,7 +162,7 @@ module HTML #:nodoc: + end + + closing = ( scanner.scan(/\//) ? :close : nil ) +- return Text.new(parent, line, pos, content) unless name = scanner.scan(/[\w:-]+/) ++ return Text.new(parent, line, pos, content) unless name = scanner.scan(/[-:\w\x00-\x09\x0b-\x0c\x0e-\x1f]+/) + name.downcase! + + unless closing +index bae0f5c..51baba6 100644 +@@ -19,6 +19,7 @@ class SanitizerTest < Test::Unit::TestCase + assert_equal "This has a here.", sanitizer.sanitize("This has a here.") + assert_equal "This has a here.", sanitizer.sanitize("This has a ]]> here.") + assert_equal "This has an unclosed ", sanitizer.sanitize("This has an unclosed ]] here...") ++ assert_equal "non printable char is a tag", sanitizer.sanitize("<\x07a href='/hello'>non printable char is a tag") + [nil, '', ' '].each { |blank| assert_equal blank, sanitizer.sanitize(blank) } + end + +-- +1.6.0.1 + diff --git a/rubygem-actionpack.spec b/rubygem-actionpack.spec index 7492097..2dc35f1 100644 --- a/rubygem-actionpack.spec +++ b/rubygem-actionpack.spec @@ -7,7 +7,7 @@ Summary: Web-flow and rendering framework putting the VC in MVC Name: rubygem-%{gemname} Version: 2.1.1 -Release: 3%{?dist} +Release: 4%{?dist} Group: Development/Languages License: MIT URL: http://www.rubyonrails.org @@ -15,6 +15,10 @@ Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.tgz Patch1: rubygem-actionpack-2.1.2-CVE-2008-5189.patch # http://weblog.rubyonrails.org/2009/9/4/xss-vulnerability-in-ruby-on-rails Patch2: rubygem-actionpack-2.1.x-CVE-2009-3009.patch +# bug 544329 +Patch3: rubygem-actionpack-2.1.x-verify-also-text.patch +# bug 542786 +Patch4: rubygem-actionpack-2.2.x-strip_tag-for-nonprintable.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: rubygems Requires: rubygem(activesupport) = %{version} @@ -33,6 +37,8 @@ unit/integration testing that doesn't require a browser. %setup -q -n %{gemname}-%{version} %patch1 -p2 %patch2 -p2 +%patch3 -p2 +%patch4 -p2 %build rake gem @@ -65,6 +71,10 @@ rm -rf %{buildroot} %changelog +* Mon Dec 7 2009 Mamoru Tasaka - 2.1.1-4 +- Fix for potential CSRF protection circumvention (bug 544329) +- Fix for XSS weakness in strip_tags (bug 542786) + * Mon Sep 21 2009 Mamoru Tasaka - 2.1.1-3 - Patch for CVE-2009-3009 (bug 520843)