Repository navigation
Reject TrustedHTML with an unvetted sanitizer or runScripts - #616
Merged
noamr merged 4 commits intoSep 28, 2026
Merged
Conversation
Without a `TrustedHTMLParserOptions` or a default policy's `createParserOptions`, a caller-supplied `sanitizer` or `runScripts: true` could make vetted markup unsafe. Fixes w3c#615. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
An empty `sanitizer` is the IDL default, so it counts as no sanitizer. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Contributor
Author
|
|
`createContextualFragment` sets `runScripts` to true, so rejecting it would break `TrustedHTML` there. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
TrustedHTML with an unvetted sanitizer or runScriptsTrustedHTML with an unvetted sanitizer
Contributor
Author
|
In XML-parsing entry points I believe the sanitizer is always empty, so it won't throw. Changed to not throw for |
Sinks that construct their own options, like `createContextualFragment`, pass false for the new `optionsFromAuthor` argument. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
zcorpan
added a commit
to whatwg/html
that referenced
this pull request
Sep 26, 2026
This lets Trusted Types reject author-supplied `runScripts` without breaking `createContextualFragment`. See w3c/trusted-types#616. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
TrustedHTML with an unvetted sanitizerTrustedHTML with an unvetted sanitizer or runScripts
noamr
pushed a commit
to whatwg/html
that referenced
this pull request
Sep 28, 2026
This lets Trusted Types reject author-supplied `runScripts` without breaking `createContextualFragment`. See w3c/trusted-types#616. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
zcorpan
added a commit
to web-platform-tests/wpt
that referenced
this pull request
Sep 29, 2026
For w3c/trusted-types#616. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
lando-worker Bot
pushed a commit
to mozilla-firefox/firefox
that referenced
this pull request
Oct 6, 2026
…hat need vetting, a=testonly Automatic update from web-platform-tests Test `TrustedHTML` with parser options that need vetting For w3c/trusted-types#616. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> -- wpt-commits: 43681d686ca43bfb9ae5e0bb9e775dc25246d9c4 wpt-pr: 63042
noamr
pushed a commit
to whatwg/html
that referenced
this pull request
Oct 6, 2026
This lets Trusted Types reject author-supplied `runScripts` without breaking `createContextualFragment`. See w3c/trusted-types#616. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
noamr
added a commit
that referenced
this pull request
Oct 7, 2026
* Enable createParserOptions, passing a sanitizer to trusted types
`createParserOptions` receives a `SetHTML{Unsafe}Options` and turns them into
a `TrustedParserOptions` using the given method from the policy config.
This is the `trusted-types` part of #594
(Need to wire it to HTML as well)
* Update TrustedParserOptions to expose only Window
* Update index.bs
* Introduce `runScripts` and potentially "throw if missing"
* mutation
* Wrap createHTML+createParserOptions
* Add prose and examples for createParserOptions
* Fix build
* Update spec/index.bs
Co-authored-by: Anne van Kesteren <[email protected]>
* Update spec/index.bs
Co-authored-by: Anne van Kesteren <[email protected]>
* Update spec/index.bs
Co-authored-by: Anne van Kesteren <[email protected]>
* nits
* Ensure mutations in place don't work
* biblio
* Use sanitizer() method
* Use a sanitizer() method
* Fix up sinkGroup argument
* Fix indentation
* Add note about
* Only expose createParserOptions in Window
* Allow null sanitizer
* Throw here when returning a sanitizer for an XML doc
* Undo throwing based on doc type
* get trusted compliant input does not need a type
* Fix throwIfMissing polarity for stream inputs and default sanitizer config to null
* No need for 'stream'
* Update spec/index.bs
Co-authored-by: Simon Pieters <[email protected]>
* Update spec/index.bs
Co-authored-by: Simon Pieters <[email protected]>
* nits
* Fix a few arguments
* Fix issues from offline review
* TrustedHTML
* Inverse calls. When createParserOptions returns a sanitizer,
we don't need to also call createHTML.
* No need to call createHTML if sanitizer is invoked
* nits
* Handle preset
* Refine TrustedHTML case
* Fix build
* typo
* Fix cloning
* rename algo
* notes
* Remove TrustedParserOptions rfrom typedef
* Address review comments on createParserOptions and sanitizer config
* Pass documentType ('html' or 'xml') instead of boolean
* Editorial: address review comments on TT and XML handling
* Editorial: clean up XML note and assert non-null configuration
* Update spec/index.bs
Co-authored-by: Anne van Kesteren <[email protected]>
* nits
* config->uration
* TrustedHTMLParserOptions without members
* Use compliantOptions' sanitizer
* Remove TrustedHTML special casing
* Clarify that createHTML is a fallback
* Add a table for different inputs/outputs
* Improve table
* Add sanitizer column
* Allow policy to set runScripts to true
* Wrap table in div
* Move table to non-normative section
* Make note more concise
* Reject `TrustedHTML` with an unvetted sanitizer or `runScripts` (#616)
* Reject `TrustedHTML` with an unvetted sanitizer or `runScripts`
Without a `TrustedHTMLParserOptions` or a default policy's `createParserOptions`, a caller-supplied `sanitizer` or `runScripts: true` could make vetted markup unsafe.
Fixes #615.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Check unvetted options in parser options and ignore empty `sanitizer`
An empty `sanitizer` is the IDL default, so it counts as no sanitizer.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Don't reject `runScripts` without a parser policy
`createContextualFragment` sets `runScripts` to true, so rejecting it would break `TrustedHTML` there.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Reject author-supplied `runScripts` without a parser policy
Sinks that construct their own options, like `createContextualFragment`, pass false for the new `optionsFromAuthor` argument.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
* Address AI review comments
* The default safe config needs vetting
* Helper for arguments
---------
Co-authored-by: Anne van Kesteren <[email protected]>
Co-authored-by: Simon Pieters <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
zerox80
pushed a commit
to zerox80/firefox
that referenced
this pull request
Oct 16, 2026
…hat need vetting, a=testonly Automatic update from web-platform-tests Test `TrustedHTML` with parser options that need vetting For w3c/trusted-types#616. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> -- wpt-commits: 43681d686ca43bfb9ae5e0bb9e775dc25246d9c4 wpt-pr: 63042
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.
Without a
TrustedHTMLParserOptionsor a default policy'screateParserOptions, an author-supplied non-emptysanitizerorrunScripts: truecould make vetted markup unsafe.Fixes #615. Based on #606.
Preview | Diff