SECURITY: Remove event handlers from SVG files

This commit is contained in:
Dan Ungureanu
2019-12-11 16:28:35 +02:00
parent adfa793731
commit 4e130f1e03
2 changed files with 23 additions and 0 deletions

View File

@ -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