File tree Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 77 - 2.4
88 - 2.5
99 - 2.6
10+ - 2.7
11+ - 3.0
1012 - ruby-head
1113 - jruby
1214matrix :
Original file line number Diff line number Diff line change 1+ ## next / unreleased
2+
3+ * Processing Instructions are no longer allowed by Rails::Html::PermitScrubber
4+
5+ Previously, a PI with a name (or "target") matching an allowed tag name was not scrubbed. There
6+ are no known security issues associated with these PIs, but similar to comments it's preferred to
7+ omit these nodes when possible from sanitized output.
8+
9+ Fixes #115 .
10+
11+ * Mike Dalessio*
12+
113## 1.3.0
214
315* Address deprecations in Loofah 2.3.0.
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ def scrub(node)
6868 end
6969 return CONTINUE if skip_node? ( node )
7070
71- unless keep_node? ( node )
71+ unless node . element? && keep_node? ( node )
7272 return STOP if scrub_node ( node ) == STOP
7373 end
7474
Original file line number Diff line number Diff line change @@ -521,6 +521,14 @@ def test_uri_escaping_of_name_action_in_a_tag_in_safe_list_sanitizer
521521 assert_equal %{<a action=\" examp<!--%22%20unsafeattr=foo()>-->le.com\" >test</a>} , text
522522 end
523523
524+ def test_exclude_node_type_processing_instructions
525+ assert_equal ( "<div>text</div><b>text</b>" , safe_list_sanitize ( "<div>text</div><?div content><b>text</b>" ) )
526+ end
527+
528+ def test_exclude_node_type_comment
529+ assert_equal ( "<div>text</div><b>text</b>" , safe_list_sanitize ( "<div>text</div><!-- comment --><b>text</b>" ) )
530+ end
531+
524532protected
525533
526534 def xpath_sanitize ( input , options = { } )
You can’t perform that action at this time.
0 commit comments