</script> inside quotes is closing script tag. |
|||
Issue descriptionChrome Version : 60.0.3112.113 Behavior in Firefox 56.0: The same I am unsure if this is a known problem, but it could cause some security issue if not: I have a simple html file containing: <html> <body> <script> var a = "</script>b" </script> </body> </html> The problem is that the script end-tag in the quotes (</script>) is recognized as proper end tag for the script. Then Chrome shows b", instead of an empty page. So, even though the </script> is in quotes, it is treated as a valid end tag. Any other tags like </body> or <script> are trated as part of the value of a. If this is a bug it could cause XSS.
,
Oct 13 2017
Chrome is parsing the example HTML as specified: https://html.spec.whatwg.org/multipage/parsing.html#script-data-state This is specified behavior from early days of HTML4. You can try filing a spec bug, but I'm afraid that changing this behavior will affect a lot of existing websites.
,
Oct 17 2017
I agree, it is defined like this in the specification. You wrote that changing the specification will affect a lot of existing websites: Is there any use case where it actually makes sense to allow this? To my mind, the only things which would break when changing the spec would be invalid html pages (e.g. no closing " and suddenly closing the script-tag) and some XSS possibilities (which is a good thing).
,
Oct 25 2017
This is one of the reasons why the W3C HTML validator warned about unescaped lower-than symbols for a long time. The XSS issue arises if someone does not do proper escaping. In the case inline scripts developers have to think about Javascript and HTML.
,
Dec 27 2017
As Blink cannot take any action on this, as working as expected/specced, per comment #2. Let's close this. csperl@ I'm not sure you can get answers to your question here. If you think it would be good to have spec change and change the parser behavior (for all browsers, for compatibility), https://github.com/whatwg/html would be the better place. |
|||
►
Sign in to add a comment |
|||
Comment 1 by vamshi.k...@techmahindra.com
, Oct 13 2017Components: Blink>HTML>Script
Labels: Needs-Milestone Triaged-ET M-63 OS-Linux OS-Mac OS-Windows
Status: Untriaged (was: Unconfirmed)