Sanitize while parsing - #12756
Open
noamr wants to merge 15 commits into
Open
Conversation
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
August 5, 2026 09:31
7b105e3 to
e24c23b
Compare
5 tasks
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
3 times, most recently
from
August 7, 2026 20:17
4ff3705 to
8551681
Compare
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
August 11, 2026 20:09
c374a0b to
e8c7cba
Compare
zcorpan
reviewed
Aug 12, 2026
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
2 times, most recently
from
August 12, 2026 16:07
1d9e935 to
4453c2a
Compare
zcorpan
approved these changes
Aug 13, 2026
zcorpan
requested changes
Aug 14, 2026
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
August 14, 2026 08:52
4453c2a to
931141c
Compare
keithamus
reviewed
Aug 14, 2026
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
August 15, 2026 10:04
32e5b9a to
1b77b8d
Compare
brave-builds
pushed a commit
to brave/chromium
that referenced
this pull request
Aug 17, 2026
Sanitization should take place while performing the adoption agency algorithm, otherwise some nodes can be missed. Since adoption agency often adds an intermediate element, the ReplaceWithChildren directive essentially negates it, while Remove reparents the children into the intermediate element and removes all of them. This is in line with spec changes made as part of whatwg/html#12756 Bug: 498272014 Change-Id: Ieb755555635e197f8ed7daf06a08679a0f2d38c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8250959 Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org> Cr-Commit-Position: refs/heads/main@{#1680770}
chromium-wpt-export-bot
pushed a commit
to web-platform-tests/wpt
that referenced
this pull request
Aug 17, 2026
Sanitization should take place while performing the adoption agency algorithm, otherwise some nodes can be missed. Since adoption agency often adds an intermediate element, the ReplaceWithChildren directive essentially negates it, while Remove reparents the children into the intermediate element and removes all of them. This is in line with spec changes made as part of whatwg/html#12756 Bug: 498272014 Change-Id: Ieb755555635e197f8ed7daf06a08679a0f2d38c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8250959 Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org> Cr-Commit-Position: refs/heads/main@{#1680770}
chromium-wpt-export-bot
pushed a commit
to web-platform-tests/wpt
that referenced
this pull request
Aug 17, 2026
Sanitization should take place while performing the adoption agency algorithm, otherwise some nodes can be missed. Since adoption agency often adds an intermediate element, the ReplaceWithChildren directive essentially negates it, while Remove reparents the children into the intermediate element and removes all of them. This is in line with spec changes made as part of whatwg/html#12756 Bug: 498272014 Change-Id: Ieb755555635e197f8ed7daf06a08679a0f2d38c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8250959 Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org> Cr-Commit-Position: refs/heads/main@{#1680770}
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
August 19, 2026 16:22
1b77b8d to
2eb51b7
Compare
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
September 2, 2026 10:26
be95755 to
50182d4
Compare
zcorpan
reviewed
Sep 2, 2026
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
September 2, 2026 14:58
50182d4 to
fd9f9dc
Compare
zcorpan
requested changes
Sep 2, 2026
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
September 3, 2026 08:18
b202606 to
16572fe
Compare
zcorpan
reviewed
Sep 3, 2026
zcorpan
approved these changes
Sep 3, 2026
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
September 3, 2026 20:52
0c49f36 to
ca03f6d
Compare
zcorpan
approved these changes
Sep 4, 2026
…nfig canonicalization
…nitizer config from options
…oreign element, script, and template insertion
…for Replace with children
noamr
force-pushed
the
noamr/streaming-sanitizer
branch
from
September 4, 2026 16:10
ca03f6d to
745e3da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of parsing into a fragment and then statically sanitizing that fragment, sanitize as we parse.
This entails the following changes:
DocumentFragment, and also to redirect elements to their nearest non-replaced ancestor when a child is stripped but its children are kept.Note that this still leaves out important follow ups, where we need to sometimes sanitize before the element is even created (e.g. declarative shadow roots and
is), and having a live sanitizer config while parsing gives us the infrastructure for that.Closes #12560
Closes #12543
(See WHATWG Working Mode: Changes for more details.)
💥 Error: Wattsi server error 💥
PR Preview failed to build. (Last tried on Aug 28, 2026, 2:28 PM UTC).
More
PR Preview relies on a number of web services to run. There seems to be an issue with the following one:
🚨 Wattsi Server - Wattsi Server is the web service used to build the WHATWG HTML spec.
🔗 Related URL
Error output:
This seems to be an issue with the Wattsi Server service. PR Preview doesn't manage this service and so has no control over it. If you've identified an issue with it, you can report the issue to the maintainers of Wattsi Server directly. Please be courteous. Thank you!
If you don't have enough information above to solve the error by yourself or if the issue doesn't seem related to Wattsi Server, you can file an issue with PR Preview.