mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:01:18 +08:00
SECURITY: Remove event handlers from SVG files
This commit is contained in:
@ -277,6 +277,7 @@ class UploadCreator
|
||||
def whitelist_svg!
|
||||
doc = Nokogiri::XML(@file)
|
||||
doc.xpath(svg_whitelist_xpath).remove
|
||||
doc.xpath("//@*[starts-with(name(), 'on')]").remove
|
||||
File.write(@file.path, doc.to_s)
|
||||
@file.rewind
|
||||
end
|
||||
|
Reference in New Issue
Block a user