(no title)
ishouldbework | 4 months ago
Emphasis mine. I do not understand this design choice. If I explicitly allow `script` tag, why should it be stripped?
If the method was called setXSSSafeSubsetOfHTML sure I guess, but feels weird for setHTML to have impossible-to-override filter.
masklinn|4 months ago
It really doesn’t. We’ve decades of experience telling us that safe behaviour is critical.
> I do not understand this design choice. If I explicitly allow `script` tag, why should it be stripped?
Because there’s an infinitesimal number of situations where it’s not broken, and that means you should have to put in work to get there.
`innerHTML` still exists, and `setHTMLUnsafe` has no filtering whatsoever by default (not even the script deactivation innerHTML performs).
ishouldbework|4 months ago
strbean|4 months ago
meowface|4 months ago
hsbauauvhabzb|4 months ago
evilpie|4 months ago
recursivecaveat|4 months ago
jmull|4 months ago
Meanwhile, there's "setHTMLUnsafe()" and, of course, good old .innerHTML.
wewtyflakes|4 months ago
systoll|4 months ago
I’d’ve made it a runtime error to call setHTML with an unsafe config, but Javascript tends toward implicit reinterpretation rather than erroring-out.
unknown|4 months ago
[deleted]