From 21da9b62baf9ea659811d92e6b574130aee57eba Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 30 Apr 2020 09:40:19 -0400 Subject: [PATCH] Avoid testing nokogiri's patch when using system libxml2 related to #198 --- test/test_malicious_html.rb | 6 ++++++ 1 file changed, 6 insertions(+) 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: # 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}='example.com'>foo] 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}='example.com'>foo] 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).