You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the algorithm throws an error, throw an EvalError.
If sourceString is not equal to codeString, throw an EvalError.
Main points:
When isTrusted is true, these steps essentially do nothing ("Get Trusted Type compliant string" will return immediately with codeString) why are they ever needed?
When isTrusted is false, this throws iff the createTrustedScript callback of the default policy actually modifies the value. This can be counter-intuitive (like it would continue execution with a lax policy that does not touch unsafe input while a strict policy that sanitize the code would likely throw) and I would expect something similar to https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-write-steps instead. But it seems it was something agreed with TC39 folks with the reasoning "if the string is not modified by the default policy it is likely because the input is safe". I guess it's fine security-wise, it's a stricter condition than always considering the sanitized string.
So for this issue the things we could do is to explicitly skip these steps (and simplify them) when isTrusted = true. And when isTrusted=false, maybe add a non-normative note explaining the rationale discussed with TC39 folks, so implementers are not surprised.
The text was updated successfully, but these errors were encountered:
fred-wang
changed the title
EnsureCSPDoesNotBlockStringCompilation: caling "Get Trusted Type compliant string"
EnsureCSPDoesNotBlockStringCompilation: calling "Get Trusted Type compliant string"
Dec 4, 2024
cc @koto @lukewarlow
This was initially opened in the wrong repo (web-platform-tests/wpt#49367) but to re-explain, this is about steps 5-8 in https://w3c.github.io/webappsec-csp/#can-compile-strings :
Main points:
So for this issue the things we could do is to explicitly skip these steps (and simplify them) when isTrusted = true. And when isTrusted=false, maybe add a non-normative note explaining the rationale discussed with TC39 folks, so implementers are not surprised.
The text was updated successfully, but these errors were encountered: