-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the HTML parser's scripting flag not depend on "scripting was enabled" #9426
Comments
That would be a significant UX regression, given it would mean The even more radical suggestion would be to parse as if scripting is disabled (so As a mostly-absentee maintainer of a library containing a sanitizer (html5lib), the |
Right it would be mostly useless. Maybe the Always parsing |
It would be nice if |
@mozfreddyb it does that today as well as different parsing. https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements It's not clear to me if |
I could see making HTML fragment parsing better account for the state of the context node's node document. If we want to completely revisit the way this works this needs some more historical context. E.g., I'm pretty sure it was fairly recently that we did the work around sandboxing and that making that work the same as scripting being disabled was an intentional design choice. Note that changing the way |
https://html.spec.whatwg.org/multipage/parsing.html#other-parsing-state-flags says
This flag affects parsing of
noscript
, and "scripting was enabled" is disabled for an<iframe sandbox>
document (withoutallow-scripts
) as well as these:It's also disabled for
<template>
's template contents owner document, at least as implemented in WebKit and Chromium (but Gecko parses with scripting flag enabled), see http://software.hixie.ch/utilities/js/live-dom-viewer/saved/11796This has caused mutation XSS issues in the past, see https://www.acunetix.com/blog/web-security-zone/mutation-xss-in-google-search/
I think it's not great that
noscript
is parsed differently for different documents that can be accessed from script.noscript
was intended to show content to users when they had scripting disabled in the browser. Introducing parsing differences in different places invites XSS bugs.Would it be web compatible to make the HTML parser's scripting flag only depend on whether the user has disabled scripting?
Alternatively, drop the scripting flag completely and always parse as if scripting is enabled, but this might regress the UX for users who disable script.
@whatwg/html-parser @whatwg/security
The text was updated successfully, but these errors were encountered: