Skip to content

Commit 798ea0c

Browse files
committed
Fix ReDoS vulnerability in PermitScrubber by optimizing regex
1 parent c5734e5 commit 798ea0c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rails/html/scrubbers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def scrub_attribute(node, attr_node)
146146
Loofah::HTML5::Scrub.scrub_attribute_that_allows_local_ref(attr_node)
147147
end
148148

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

0 commit comments

Comments
 (0)