4 ms·
Ah svg, reminds me these fine windows metafile days. Seriously, can we stop inventing formats that execute arbitrary code under the hood?
by wruza 6y ago
Ah svg, reminds me these fine windows metafile days.
Seriously, can we stop inventing formats that execute arbitrary code under the hood?
- colejohnson66 6y agoThe problem isn’t SVG necessarily. It’s a nice vector format with many hidden features available to those who explore (especially with SVG 2 around the corner). The problem is JavaScript. Unfortunately, there’s not much one can do if they want interactive images[a][b] short of a Turing Complete language. And if you’re going to need that, JavaScript’s right there (for better or for worse). [a]: Embedding the SVG directly into the HTML and manipulating it using the JavaScript in the HTML is an option, but not many people do that [b]: We can argue all we want about whether we should be making interactive images in the first place, but the fact of the matter is, either you add it to your format, or someone else will
- gitgud 6y agoCan svg's even do anything malicious with that capability?
- eyelidlessness 6y agoWhere they can execute JS, they can do so in the same security context as the containing document. So, yeah, they can be used in situ for any privacy or security intrusion that a script tag can.
- felixfbecker 6y agoThis is not entirely correct. An SVG file embedded in an <iframe> or <object> is a document itself, and if cross-origin, can not access the outer document. However, if not in a sandboxed iframe, it can still do things like trigger alert prompts or navigation.
- eyelidlessness 6y agoSorry, this is right. I should have said it’s just as capable or limited in SVG as a bare script tag in the same place.
- eyelidlessness 6y agoEvery time someone does, someone else comes along and either presents a compelling enough use case that arbitrary execution is introduced or just wraps the thing in an environment where it’s funneled in.