News for hackers. Stuff that matters.
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by pornel on Tuesday February 24, 2026 @09:52AM (#47137886)
BTW, HTML allows inline SVG with an XML-flavored syntax that interprets <script/> and <title> differently. It's a goldmine for sanitizer escapes. There are completely bonkers syntax switching and error recovery rules that interact with parsing modes (there's even an edge case where a particular attribute value switches between HTML and XML-ish parsing rules).

Don't even try to allow inline <svg> from untrusted sources! (and then you still must sanitise any svg files you host)

Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by kccqzy on Tuesday February 24, 2026 @10:55AM (#47138677)
If you just serve SVGs through <img> tag it’ll be much safer. I never understood the appeal of inline <svg> anyways.
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by rwj on Tuesday February 24, 2026 @11:58AM (#47139423)
Inline reduces round trips.
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by toast0 on Tuesday February 24, 2026 @12:11PM (#47139618)
You can use img with a data url?
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by lenkite on Tuesday February 24, 2026 @12:19PM (#47139753)
Inline SVG is stylable with CSS styles in the same HTML page.
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by runarberg on Tuesday February 24, 2026 @02:01PM (#47141124)
Also animatible with the same context (Animation API, etc.) as the parent page, so different SVGs can influence each other’s animations.