Skip to content

Commit 26a34b1

Browse files
ch4n3-yoonflavorjones
authored andcommitted
Fix ReDoS vulnerability in PermitScrubber by optimizing regex
1 parent 9250229 commit 26a34b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: lib/rails/html/scrubbers.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def scrub_attribute(node, attr_node)
150150
Loofah::HTML5::Scrub.scrub_attribute_that_allows_local_ref(attr_node)
151151
end
152152

153-
if Loofah::HTML5::SafeList::SVG_ALLOW_LOCAL_HREF.include?(node.name) && attr_name == "xlink:href" && attr_node.value =~ /^\s*[^#\s].*/m
153+
if Loofah::HTML5::SafeList::SVG_ALLOW_LOCAL_HREF.include?(node.name) && attr_name == "xlink:href" && attr_node.value =~ /^\s*[^#].*/m
154154
attr_node.remove
155155
end
156156

0 commit comments

Comments
 (0)