public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/rubygem-loofah] rawhide: Backport upstream patch to support nokogiri 1.19.7 html5 behavior fix
Date: Thu, 05 Nov 2026 05:03:43 GMT	[thread overview]
Message-ID: <179385502372.1.8311119844377088485.rpms-rubygem-loofah-8920fe8dbddd@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/rubygem-loofah
Branch : rawhide
Commit : 8920fe8dbddd80bf8525f42137c4fe95d5ea021e
Author : Mamoru TASAKA <mtasaka@fedoraproject.org>
Date   : 2026-11-05T14:03:29+09:00
Stats  : +80/-7 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/rubygem-loofah/c/8920fe8dbddd80bf8525f42137c4fe95d5ea021e?branch=rawhide

Log:
Backport upstream patch to support nokogiri 1.19.7 html5 behavior fix

---
diff --git a/loofah-pr324-nokogiri-1_19_7-html5.patch b/loofah-pr324-nokogiri-1_19_7-html5.patch
new file mode 100644
index 0000000..a0fc131
--- /dev/null
+++ b/loofah-pr324-nokogiri-1_19_7-html5.patch
@@ -0,0 +1,69 @@
+From 7ba1e7b77e043fb7dc832ef746fcbf83137135e6 Mon Sep 17 00:00:00 2001
+From: Mike Dalessio <mike.dalessio@gmail.com>
+Date: Sun, 1 Nov 2026 23:19:35 -0500
+Subject: [PATCH] fix: require Nokogiri >= 1.19.5 to prevent mXSS in HTML5
+ scrubbers
+
+Nokogiri < 1.19.5 left `<` and `>` unescaped in attribute values, so
+HTML5 scrubber output could turn into new markup when a browser parsed
+it again.
+
+Require Nokogiri >= 1.19.5, which escapes them. Remove the redundant
+Nokogiri version check from `Loofah.html5_support?`.
+
+ref: https://github.com/flavorjones/loofah/security/advisories/GHSA-h6v6-rg66-fqj4
+---
+ CHANGELOG.md                    |  1 +
+ lib/loofah.rb                   |  8 +-------
+ loofah.gemspec                  |  2 +-
+ test/integration/test_ad_hoc.rb | 14 ++++++++++----
+ 4 files changed, 13 insertions(+), 12 deletions(-)
+
+diff --git a/lib/loofah.rb b/lib/loofah.rb
+index c5fe508..adfc591 100644
+--- a/lib/loofah.rb
++++ b/lib/loofah.rb
+@@ -5,13 +5,7 @@
+ module Loofah
+   class << self
+     def html5_support?
+-      # Note that Loofah can only support HTML5 in Nokogiri >= 1.14.0 because it requires the
+-      # subclassing fix from https://github.com/sparklemotion/nokogiri/pull/2534
+-      return @html5_support if defined? @html5_support
+-
+-      @html5_support =
+-        Gem::Version.new(Nokogiri::VERSION) > Gem::Version.new("1.14.0") &&
+-        Nokogiri.uses_gumbo?
++      Nokogiri.uses_gumbo?
+     end
+   end
+ end
+diff --git a/test/integration/test_ad_hoc.rb b/test/integration/test_ad_hoc.rb
+index e546656..dcc652f 100644
+--- a/test/integration/test_ad_hoc.rb
++++ b/test/integration/test_ad_hoc.rb
+@@ -441,7 +441,7 @@ def test_dont_remove_whitespace_between_tags
+             expected = if html_version == :html4
+               %{<div alt="this &lt; that">wave</div>}
+             else
+-              %{<div alt="this < that">wave</div>}
++              %{<div alt="this &lt; that">wave</div>}
+             end
+             actual = scrub_fragment(input, :escape)
+ 
+ 
+@@ -464,6 +464,14 @@ def test_dont_remove_whitespace_between_tags
+             assert_equal(expected, actual.to_html)
+           end
+         end
++
++        it "does not let an attribute value become markup when stripped MathML is reparsed" do
++          html = %{<math><mtext><mglyph><textarea><a title="</textarea><img src=x onerror=alert(1)>">}
++
++          reparsed = fragment(scrub_fragment(html, :strip).to_html)
++
++          assert_nil(reparsed.at_css("[onerror]"))
++        end
+       end
+     end
+   end

diff --git a/rubygem-loofah.spec b/rubygem-loofah.spec
index b71d11e..367fb2a 100644
--- a/rubygem-loofah.spec
+++ b/rubygem-loofah.spec
@@ -2,7 +2,7 @@
 
 Name: rubygem-%{gem_name}
 Version: 2.22.0
-Release: 11%{?dist}
+Release: 12%{?dist}
 Summary: Manipulate and transform HTML/XML documents and fragments
 License: MIT
 URL: https://github.com/flavorjones/loofah
@@ -18,10 +18,13 @@ Patch1:  %{gem_name}-pr298-testsuite-accept-libxml2-2_14.patch
 # https://github.com/flavorjones/loofah/pull/307
 # Fix json 3 compatibility
 Patch2: %{gem_name}-pr307-support-json3-allow-comments.patch
+# https://github.com/flavorjones/loofah/pull/324/changes/7ba1e7b77e043fb7dc832ef746fcbf83137135e6
+# Nokogiri is updated to 1.19.7, fixing HTML5 behavior
+Patch3: %{gem_name}-pr324-nokogiri-1_19_7-html5.patch
 BuildRequires: ruby(release)
 BuildRequires: rubygems-devel
 BuildRequires: ruby
-BuildRequires: rubygem(nokogiri) >= 1.6.6.2
+BuildRequires: rubygem(nokogiri) >= 1.9.5
 BuildRequires: rubygem(minitest)
 BuildRequires: rubygem(minitest-mock)
 BuildRequires: rubygem(crass)
@@ -43,13 +46,11 @@ BuildArch: noarch
 Documentation for %{name}.
 
 %prep
-%setup -q -n %{gem_name}-%{version} -b1
-(
-cd %{_builddir}
+%setup -q -n %{gem_name}-%{version} -a1
 %patch -P0 -p1
 %patch -P1 -p1
 %patch -P2 -p1
-)
+%patch -P3 -p1
 
 %build
 gem build ../%{gem_name}-%{version}.gemspec
@@ -63,8 +64,8 @@ cp -a .%{gem_dir}/* \
 
 
 %check
+cp -a test .%{gem_instdir}
 pushd .%{gem_instdir}
-cp -a %{_builddir}/test .
 
 ruby -Ilib:test -e 'Dir.glob "./test/**/test_*.rb", &method(:require)'
 popd
@@ -83,6 +84,9 @@ popd
 %doc %{gem_instdir}/SECURITY.md
 
 %changelog
+* Thu Nov 05 2026 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.22.0-12
+- Backport upstream patch to support nokogiri 1.19.7 html5 behavior fix
+
 * Sun Sep 20 2026 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.22.0-11
 - Apply upstream patch to support json 3
 

                 reply	other threads:[~2026-11-05  5:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179385502372.1.8311119844377088485.rpms-rubygem-loofah-8920fe8dbddd@fedoraproject.org \
    --to=mtasaka@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox