Enable createParserOptions, passing a sanitizer to trusted types - #606
Enable createParserOptions, passing a sanitizer to trusted types#606noamr wants to merge 29 commits into
Conversation
|
LGTM |
ced3862 to
d44dcea
Compare
|
I've made some changes:
(Note: this PR will fail build until we merge the latter) |
|
Are you able to fix the build failure now? |
I'll revisit this once I have the HTML counterpart ready. |
|
|
||
| ## Get Trusted Type parser input ## {#get-trusted-type-parser-input-algorithm} | ||
|
|
||
| To <dfn export>get Trusted Type compliant input</dfn> given a {{TrustedType}} |expectedType|, a [=realm/global object=] (|global|), string, or <code data-x="">Stream</code> |input|, |
There was a problem hiding this comment.
It's a special value meaning that we don't have a string yet and we are going to stream the HTML. is null better? This seemed more descriptive.
|
Also, reportedly this impacts |
Added prose and examples for this |
|
(The build failure is in main, trying to resolve separately. Do you have an idea maybe @lukewarlow ?) |
|
In Also I feel like we should probably always return a Sanitizer object, instead of one of three options? Otherwise it seems easy to accidentally write code (not sure what for though?) that only works with a subset. |
It's a good point. I guess we need to return a clone of the underlying sanitizer if the getter is invoked so that you couldn't get a
Yea I was contemplating that. SGTM |
`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)
Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
I guess it's kind of expected as a reflection, the same way you can stringify a The mutability thing is a bit awkward but in most cases it wouldn't have any effect. |
|
I have a feeling that a function is a better way to do the access for the sanitizer object. It feels more logical that a function returns a clone of an object rather than directly allowing mutations. But I'm curious for others thoughts here. |
you mean something like |
Done |
|
@lukewarlow having checked this, I think I have slight preference to keeping it as a getter, as it has the nice ergonomic benefit of being able to pass it to |
|
Can we change it so that just works though? It feels like we could. I'm happy to leave it as a getter if that's preferred though. |
Yea I guess its nicer as a method, and we can allow TrustedParserOptions in the IDL explicitly |
This is instead of retaining a frozen copy. See w3c/trusted-types#606 Bug: 491743369 Change-Id: Ida4d1a661edb8475cbc4a1b2ce0d0e3d38913024 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8097523 Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1663095}
This is instead of retaining a frozen copy. See w3c/trusted-types#606 Bug: 491743369 Change-Id: Ida4d1a661edb8475cbc4a1b2ce0d0e3d38913024 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8097523 Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1663095}
This is instead of retaining a frozen copy. See w3c/trusted-types#606 Bug: 491743369 Change-Id: Ida4d1a661edb8475cbc4a1b2ce0d0e3d38913024 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8097523 Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1663095}
|
Other than the 3 changes above this PR LGTM. Haven't reviewed the HTML side yet. |
…izer in each call, a=testonly Automatic update from web-platform-tests TrustedParserOptions: return a new sanitizer in each call This is instead of retaining a frozen copy. See w3c/trusted-types#606 Bug: 491743369 Change-Id: Ida4d1a661edb8475cbc4a1b2ce0d0e3d38913024 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8097523 Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1663095} -- wpt-commits: c1e067e2346c22c0fc98bafed6618c3d92b06af0 wpt-pr: 61339
Co-authored-by: Simon Pieters <zcorpan@gmail.com>
Co-authored-by: Simon Pieters <zcorpan@gmail.com>
createParserOptionsreceives aSetHTML{Unsafe}Optionsand turns them into aTrustedParserOptionsusing the given method from the policy config.This is the
trusted-typespart of #594Note that this should only be merged when wired into the HTML standard, once the sanitizer is itself upstreamed.
Preview | Diff