-
Notifications
You must be signed in to change notification settings - Fork 3k
Escape "<" and ">" when serializing attribute values #6362
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
Conversation
7dfae8b
to
ac056b2
Compare
@zcorpan Thank you for nudging this along! Did you spend any time thinking about compat analysis? Mostly curious, I've never done any compat analysis.. |
@mozfreddyb I did think about it. I think static analysis is unlikely to find anything. What is possible is to add a use counter in Chromium (or equivalent in other engines) when the HTML serializer serializes an attribute value that contains "<" or ">". When the use counter reaches stable, the next HTTP Archive crawl will collect URLs from its data set of around 7 million pages, which can be queried with BigQuery. If there is an experimental implementation of this change, one can manually test those URLs and see if anything is obviously broken. If this quickly finds multiple things that are broken, then it likely is not a web compatible change. If nothing broken is found, then it might be web compatible, but obviously this wouldn't be a guarantee. The lack of complaints during the dev and beta period is probably a more convincing signal that it is web compatible. |
…in attribute values, a=testonly Automatic update from web-platform-tests HTML: tentative test for serializing <> in attribute values See whatwg/html#6362 -- wpt-commits: c5d4ba83796ad90ea175682d9e4477656fc5ddb5 wpt-pr: 51827
…in attribute values, a=testonly Automatic update from web-platform-tests HTML: tentative test for serializing <> in attribute values See whatwg/html#6362 -- wpt-commits: c5d4ba83796ad90ea175682d9e4477656fc5ddb5 wpt-pr: 51827
…in attribute values, a=testonly Automatic update from web-platform-tests HTML: tentative test for serializing <> in attribute values See whatwg/html#6362 -- wpt-commits: c5d4ba83796ad90ea175682d9e4477656fc5ddb5 wpt-pr: 51827
The Firefox/Gecko implementation was/is: https://bugzilla.mozilla.org/show_bug.cgi?id=1941347 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably hold off until Chromium has actually deployed this?
https://bugs.webkit.org/show_bug.cgi?id=292432 rdar://150520333 Reviewed by NOBODY (OOPS!). Implement whatwg/html#6362 and add a preference in case we find out we have to disable it in certain cases. The preference does not impact the recently added getHTML() method on Element and ShadowRoot as that should be new enough to not matter. Add new test from: web-platform-tests/wpt#27501
https://bugs.webkit.org/show_bug.cgi?id=292432 rdar://150520333 Reviewed by Ryosuke Niwa and Sam Weinig. Implement whatwg/html#6362 and add a preference in case we find out we have to disable it in certain cases. The preference does not impact the recently added getHTML() method on Element and ShadowRoot as that should be new enough to not matter. Add new test from: web-platform-tests/wpt#27501 Canonical link: https://commits.webkit.org/295149@main
Given that everyone is moving ahead with this and we still haven't seen breakage, let's flip the switch now. It's also rather awkward to keep the tests and such in limbo that long. |
ac056b2
to
1896a6a
Compare
…lues when serializing, Automatic update from web-platform-tests HTML: Escape "<" and ">" in attribute values when serializing See whatwg/html#6362. -- wpt-commits: 3fad71d22b6681a3430ff498add3ea8c31660401 wpt-pr: 27501 Differential Revision: https://phabricator.services.mozilla.com/D250932
…lues when serializing, Automatic update from web-platform-tests HTML: Escape "<" and ">" in attribute values when serializing See whatwg/html#6362. -- wpt-commits: 3fad71d22b6681a3430ff498add3ea8c31660401 wpt-pr: 27501 Differential Revision: https://phabricator.services.mozilla.com/D250932
…lues when serializing, Automatic update from web-platform-tests HTML: Escape "<" and ">" in attribute values when serializing See whatwg/html#6362. -- wpt-commits: 3fad71d22b6681a3430ff498add3ea8c31660401 wpt-pr: 27501 Differential Revision: https://phabricator.services.mozilla.com/D250932
…lues when serializing, Automatic update from web-platform-tests HTML: Escape "<" and ">" in attribute values when serializing See whatwg/html#6362. -- wpt-commits: 3fad71d22b6681a3430ff498add3ea8c31660401 wpt-pr: 27501 Differential Revision: https://phabricator.services.mozilla.com/D250932 UltraBlame original commit: b534c633b2ea53fe10c965fc83f8a795b7f7e2a8
…lues when serializing, Automatic update from web-platform-tests HTML: Escape "<" and ">" in attribute values when serializing See whatwg/html#6362. -- wpt-commits: 3fad71d22b6681a3430ff498add3ea8c31660401 wpt-pr: 27501 Differential Revision: https://phabricator.services.mozilla.com/D250932 UltraBlame original commit: b534c633b2ea53fe10c965fc83f8a795b7f7e2a8
…lues when serializing, Automatic update from web-platform-tests HTML: Escape "<" and ">" in attribute values when serializing See whatwg/html#6362. -- wpt-commits: 3fad71d22b6681a3430ff498add3ea8c31660401 wpt-pr: 27501 Differential Revision: https://phabricator.services.mozilla.com/D250932 UltraBlame original commit: b534c633b2ea53fe10c965fc83f8a795b7f7e2a8
The experiment to escape "<" and ">" in attributes has been successful and after https://crrev.com/c/6597054 it's been launched to everyone (in M138) and is a part of the spec (see whatwg/html#6362). This CL does a cleanup changes the following: 1) Removes the use counter which is no longer necessary. 2) Updates markup_formatter.{cc,h} so that "<>" are always escaped. 3) Removes EscapeLtGtInAttributes as a runtime enabled feature Note that removing the usecounter forced change to the signature of `AppendAttributeValue` method -- it no longer needs to accept `Document`. So this CL changes more files so all call sites are changed accordingly. Because this has been launched in M138, it's now safe to remove in M140. Bug: 40747109 Change-Id: If14151908eb74643fcbd2fa1d461f6002da3ccd7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6714366 Reviewed-by: Mason Freed <masonf@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Michał Bentkowski <securitymb@google.com> Cr-Commit-Position: refs/heads/main@{#1484826}
This reverts commit 8d717b4. Reason for revert: Because I failed to merge the original change in M138, it actually landed in M139. So I'm reverting this one to make sure that the cleanup will happen at M141 at the earliest. Bug: 40747109 Original change's description: > Cleanup after EscapeLtGtInAttributes experiment > > The experiment to escape "<" and ">" in attributes has been successful > and after https://crrev.com/c/6597054 it's been launched to everyone (in > M138) and is a part of the spec (see > whatwg/html#6362). > > This CL does a cleanup changes the following: 1) Removes the use > counter which is no longer necessary. 2) Updates markup_formatter.{cc,h} > so that "<>" are always escaped. 3) Removes EscapeLtGtInAttributes as a > runtime enabled feature > > Note that removing the usecounter forced change to the signature of > `AppendAttributeValue` method -- it no longer needs to accept > `Document`. So this CL changes more files so all call sites are changed > accordingly. > > Because this has been launched in M138, it's now safe to remove in M140. > > Bug: 40747109 > Change-Id: If14151908eb74643fcbd2fa1d461f6002da3ccd7 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6714366 > Reviewed-by: Mason Freed <masonf@chromium.org> > Reviewed-by: Mike West <mkwst@chromium.org> > Commit-Queue: Michał Bentkowski <securitymb@google.com> > Cr-Commit-Position: refs/heads/main@{#1484826} Bug: 40747109 Change-Id: I617c4a1159c33f4d30d52eea11eca52b58e64d26 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6769766 Reviewed-by: Mason Freed <masonf@chromium.org> Commit-Queue: Michał Bentkowski <securitymb@google.com> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/main@{#1489988}
https://bugs.webkit.org/show_bug.cgi?id=292432 rdar://150520333 Reviewed by Ryosuke Niwa and Sam Weinig. Implement whatwg/html#6362 and add a preference in case we find out we have to disable it in certain cases. The preference does not impact the recently added getHTML() method on Element and ShadowRoot as that should be new enough to not matter. Add new test from: web-platform-tests/wpt#27501 Canonical link: https://commits.webkit.org/295149@main
Avoid a class of XSS attacks where markup goes through
a lossy parse-serialize-parse roundtrip and the original
attribute value is parsed in the data state.
This reverts 4eeb8a1.
Fixes #6235.
(See WHATWG Working Mode: Changes for more details.)
/parsing.html ( diff )
/parsing.html ( diff )