mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
A streaming tokenizer (models/lib/svgSanitizer.js) replaces the regular expressions that read an SVG whole: it removes script, foreignObject, iframe/object/embed, SMIL set/animate, event handlers, javascript:/vbscript: URIs after decoding character references, dangerous CSS, DOCTYPE/ENTITY XML loops and processing instructions, wherever they are and however the file is split into chunks, with bounded memory. UTF-16 is decoded and checked. Upload sanitizing streams to a temporary file and renames it; validation checks the whole SVG instead of rejecting any over its 1 MB scan; serving pipes through the sanitizer with no 8 MB fallback to an unsanitized download. Thanks to xet7 !