The woes of sanitizing SVGs
71–80 of 118 posts
Re: The woes of sanitizing SVGs
#72Earlier quoted context omitted.
This is what happens when there isn't an adult in the room to reign things in, you get project overreach. SVGs should never have supported scripting. You want scripting in SVGs, fine, make it a different file format. I can't imagine the cumulative number of man hours wasted on this problem when the vast majority of users were just looking for a way to make their logos look sharp.
Or you can literally just manipulate your SVG through the DOM in an external JS script... I still have no idea what the original motivation behind scripts in SVGs was.
I'm don't remember precisely but I don't think you could script it from the DOM, I don't see how that could work if it's a plugin.
Re: The woes of sanitizing SVGs
#73wait... scratch is just a browser?
Re: The woes of sanitizing SVGs
#74I don't understand why it wasn't immediately understood that SVG is as dangerous as HTML. It is not, and never was, an image format. It's a markup language.
Browsers already treat the same SVG differently depending on how you embed it. strips scripts and external resource loads. and inline don't. People test with img tags, looks fine, then someone switches the embed method and everything opens up.
Re: The woes of sanitizing SVGs
#75Earlier quoted context omitted.
Or you can literally just manipulate your SVG through the DOM in an external JS script... I still have no idea what the original motivation behind scripts in SVGs was.
I imagine it may have been attractive to those who liked Flash.
Re: The woes of sanitizing SVGs
#76My first thought is "support a tiny subset of svg that probably still covers 90% of real-world use cases". I do feel that's there's two distinct types of svg - "bunch of paths with fills" and "clever dangerous stuff" where most real SVGs are of the former type. Fully expect this to be shot down by someone that's thought about this problem for longer than the 120 seconds I just spent. :)
Re: The woes of sanitizing SVGs
#77This is, by the way, why Google Slides doesn't have SVG support even though there's a nearly 15 year old ticket requesting the feature.
It's like my ticket to add data url support to sheets. It just gets punted year after year.
Re: The woes of sanitizing SVGs
#78Re: The woes of sanitizing SVGs
#79Re: The woes of sanitizing SVGs
#80The HTML Sanitizer API has a subset of SVG that is allowed by the default configuration. It won't help you with sanitizing CSS at all however, style is simply not allowed by default. https://developer.mozilla.org/en-US/docs/Web/API/HTML_Saniti... https://developer.mozilla.org/en-US/docs/Web/API/HTML_Saniti...