Audit and fix innerHTML scripting disabled parsing behavior for template
What is the issue with the HTML Standard?
Load https://hsivonen.com/test/moz/template-innerHTML.html in Firefox, Safari, and Chrome and examine the results. (Also view source.)
Observations:
- All three browsers agree on the
divcases. - All three browsers serialize text children of
noscriptintemplateas if scripting was disabled vs. indivas if scripting was enabled. - Firefox parser all cases as if scripting was enabled.
- Safari and Chrome parse the
divcases as well as thetemplatecontents that are directly in the HTML loaded from network as if scripting was enabled but parse the othertemplatecases as if scripting was disabled.
It appears that these are unintended side effects of how the appropriate template contents owner document.
It seems that template having these inconsistencies compared to div is bad and a hazard that can cause bugs on sites, and it seems that we should make template behave consistently with div here.
Unfortunately, there is existence proof of a site that depends on innerHTML on template parsing as if scripting was disabled.
It seems that
templatehaving these inconsistencies compared todivis bad and a hazard that can cause bugs on sites, and it seems that we should maketemplatebehave consistently withdivhere.
Agreed, this kind of thing has been exploited as mutation-XSS previously. https://www.acunetix.com/blog/web-security-zone/mutation-xss-in-google-search/
@mfreed7 IIRC you wanted to add a use counter for this in Chromium. Is there an issue filed?
@mfreed7 IIRC you wanted to add a use counter for this in Chromium. Is there an issue filed?
Yep, I'm happy to add a use counter, and no there isn't a bug for that yet. If you'd be so kind as to file one, I could take a look!
@mfreed7 filed https://issues.chromium.org/issues/460581850
Thanks!