summary refs log tree commit diff
path: root/gnu/packages/patches/ruby-sanitize-system-libxml.patch
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2020-05-29 23:36:38 +0200
committerMarius Bakke <marius@gnu.org>2020-05-29 23:36:38 +0200
commitfe6d003908fd8278de65761bc550240c520ef9f4 (patch)
treeabe88c7905a8907ddafc554fbeef5b0af08f835d /gnu/packages/patches/ruby-sanitize-system-libxml.patch
parent8a7a5dc7805f4628e60f90af6b2416f951d0c034 (diff)
parent031315e4f0fbc4e04ffc8adee04128c23173a1f7 (diff)
downloadguix-fe6d003908fd8278de65761bc550240c520ef9f4.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'gnu/packages/patches/ruby-sanitize-system-libxml.patch')
-rw-r--r--gnu/packages/patches/ruby-sanitize-system-libxml.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/gnu/packages/patches/ruby-sanitize-system-libxml.patch b/gnu/packages/patches/ruby-sanitize-system-libxml.patch
new file mode 100644
index 0000000000..d19eb07294
--- /dev/null
+++ b/gnu/packages/patches/ruby-sanitize-system-libxml.patch
@@ -0,0 +1,38 @@
+Fix test failures that occur when nokogiri is using system libxml:
+
+  https://github.com/rgrove/sanitize/issues/198
+
+Taken from upstream:
+https://github.com/rgrove/sanitize/commit/21da9b62baf9ea659811d92e6b574130aee57eba
+
+diff --git a/test/test_malicious_html.rb b/test/test_malicious_html.rb
+index 2c23074..0756de0 100644
+--- a/test/test_malicious_html.rb
++++ b/test/test_malicious_html.rb
+@@ -135,6 +135,8 @@
+   # The relevant libxml2 code is here:
+   # <https://github.com/GNOME/libxml2/commit/960f0e275616cadc29671a218d7fb9b69eb35588>
+   describe 'unsafe libxml2 server-side includes in attributes' do
++    using_unpatched_libxml2 = Nokogiri::VersionInfo.instance.libxml2_using_system?
++
+     tag_configs = [
+       {
+         tag_name: 'a',
+@@ -166,6 +168,8 @@
+         input = %[<#{tag_name} #{attr_name}='examp<!--" onmouseover=alert(1)>-->le.com'>foo</#{tag_name}>]
+ 
+         it 'should escape unsafe characters in attributes' do
++          skip "behavior should only exist in nokogiri's patched libxml" if using_unpatched_libxml2
++
+           # This uses Nokogumbo's HTML-compliant serializer rather than
+           # libxml2's.
+           @s.fragment(input).
+@@ -191,6 +195,8 @@
+         input = %[<#{tag_name} #{attr_name}='examp<!--" onmouseover=alert(1)>-->le.com'>foo</#{tag_name}>]
+ 
+         it 'should not escape characters unnecessarily' do
++          skip "behavior should only exist in nokogiri's patched libxml" if using_unpatched_libxml2
++
+           # This uses Nokogumbo's HTML-compliant serializer rather than
+           # libxml2's.
+           @s.fragment(input).