@@ -587,25 +587,6 @@ def test_exclude_node_type_comment
587
587
assert_equal ( "<div>text</div><b>text</b>" , safe_list_sanitize ( "<div>text</div><!-- comment --><b>text</b>" ) )
588
588
end
589
589
590
- def test_disallow_the_dangerous_safelist_combination_of_select_and_style
591
- input = "<select><style><script>alert(1)</script></style></select>"
592
- tags = [ "select" , "style" ]
593
- warning = /WARNING: Rails::Html::SafeListSanitizer: removing 'style' from safelist/
594
- sanitized = nil
595
- invocation = Proc . new { sanitized = safe_list_sanitize ( input , tags : tags ) }
596
-
597
- if html5_mode?
598
- # if Loofah is using an HTML5 parser,
599
- # then "style" should be removed by the parser as an invalid child of "select"
600
- assert_silent ( &invocation )
601
- else
602
- # if Loofah is using an HTML4 parser,
603
- # then SafeListSanitizer should remove "style" from the safelist
604
- assert_output ( nil , warning , &invocation )
605
- end
606
- refute_includes ( sanitized , "style" )
607
- end
608
-
609
590
%w[ text/plain text/css image/png image/gif image/jpeg ] . each do |mediatype |
610
591
define_method "test_mediatype_#{ mediatype } _allowed" do
611
592
input = %Q(<img src="data:#{ mediatype } ;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4=">)
@@ -733,8 +714,4 @@ def libxml_2_9_14_recovery_lt_bang?
733
714
# then reverted in 2.10.0, see https://gitlab.gnome.org/GNOME/libxml2/-/issues/380
734
715
Nokogiri . method ( :uses_libxml? ) . arity == -1 && Nokogiri . uses_libxml? ( "= 2.9.14" )
735
716
end
736
-
737
- def html5_mode?
738
- ::Loofah . respond_to? ( :html5_mode? ) && ::Loofah . html5_mode?
739
- end
740
717
end
0 commit comments