Skip to content
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

Add test to verify legacy sinks for TrustedScript are not supported #49920

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

fred-wang
Copy link
Contributor

This verifies some API for ParentNode/ChildNode [1] [2] don't do any check for trusted types. This might already be covered by IDL tests but we just perform a direct verification here. This test fails in Chromium, which is not aligned with the DOM spec here [3] and performs specific checks for HTML script elements. Chromium also implements similar behavior for ChildNodePart.replaceChildren() but that's currently not shipped [4].

[1] https://dom.spec.whatwg.org/#interface-parentnode
[2] https://dom.spec.whatwg.org/#interface-childnode
[3] w3c/trusted-types#494 (comment)
[4] https://groups.google.com/a/chromium.org/g/blink-dev/c/wIADRnljZDA/m/whzEaaAADAAJ

This verifies some API for ParentNode/ChildNode [1] [2] don't do any
check for trusted types. This might already be covered by IDL tests but
we just perform a direct verification here. This test fails in Chromium,
which is not aligned with the DOM spec here [3] and performs specific
checks for HTML script elements. Chromium also implements similar
behavior for `ChildNodePart.replaceChildren()` but that's currently not
shipped [4].

[1] https://dom.spec.whatwg.org/#interface-parentnode
[2] https://dom.spec.whatwg.org/#interface-childnode
[3] w3c/trusted-types#494 (comment)
[4] https://groups.google.com/a/chromium.org/g/blink-dev/c/wIADRnljZDA/m/whzEaaAADAAJ
@fred-wang
Copy link
Contributor Author

cc @mfreed7

@fred-wang
Copy link
Contributor Author

cc @koto @otherdaniel

@lukewarlow
Copy link
Member

Chromium also implements similar behavior for ChildNodePart.replaceChildren() but that's currently not shipped

Can you raise a bug report on Chromium to remove that and/or do a follow up test PR that adds a tentative test which includes a similar test for that.

I'm not sure if there's a spec for dom parts (doesn't seem like there is) but would be good to make sure the spec matches expectations and not just what Chrome has.

Copy link
Member

@lukewarlow lukewarlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM verified it fails in Chromium and passes in STP with the relevant flag.

@fred-wang
Copy link
Contributor Author

@lukewarlow I'm not sure either what's the status of DOM parts, I asked more on the intent to prototype thread: https://groups.google.com/a/chromium.org/g/blink-dev/c/wIADRnljZDA/m/whzEaaAADAAJ ; let's see what Mason reply and I can follow-up accordingly.

@fred-wang fred-wang merged commit dc4c466 into master Jan 6, 2025
19 checks passed
@fred-wang fred-wang deleted the legacy-trusted-scripts-sinks branch January 6, 2025 15:18
@fred-wang
Copy link
Contributor Author

@lukewarlow Mason is happy to remove the thing for ChildNodePart.replaceChildren(): https://chromium-review.googlesource.com/c/chromium/src/+/6150068 ; I guess no need to write a test for that since this feature has never been shipped so far.

sadym-chromium pushed a commit that referenced this pull request Jan 14, 2025
…49920)

This verifies some API for ParentNode/ChildNode [1] [2] don't do any
check for trusted types. This might already be covered by IDL tests but
we just perform a direct verification here. This test fails in Chromium,
which is not aligned with the DOM spec here [3] and performs specific
checks for HTML script elements. Chromium also implements similar
behavior for `ChildNodePart.replaceChildren()` but that's currently not
shipped [4].

[1] https://dom.spec.whatwg.org/#interface-parentnode
[2] https://dom.spec.whatwg.org/#interface-childnode
[3] w3c/trusted-types#494 (comment)
[4] https://groups.google.com/a/chromium.org/g/blink-dev/c/wIADRnljZDA/m/whzEaaAADAAJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants