-
Notifications
You must be signed in to change notification settings - Fork 74
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
Should all 3 script IDL setters change the associated script text value identically #517
Comments
Oh yeah, Can we just not support that? |
cc @otherdaniel and @koto curious what your thoughts on this are. I suspect that people might be using this in the wild? Question is can we remove it as a valid IDL sink or do we just document in the spec that it's an oddity and might not always work as expected? |
Isn't this the case even without Trusted Types? The spec doesn't provide any indication that the value will be functional for any given sink, only that the value has passed through a policy so there's no DOM XSS risk with assigning it.
We definitely need to cover the DOM XSS sinks with Trusted Types, and script contents being set via innerText is used commonly in applications. TT consciously tries to work with the existing sinks, as opposed to e.g. proposing new ones and disabling old ones. |
Specifically I mean trusted types related script execution errors. Because the value may mismatch in which case TT will reject it, which could be unexpected. Sounds like we should either update the implementations and spec to set the value after it's been set so that it matches. Or just to add a note that explains there may be a mismatch? |
Commonly? Can you point to an example? Given what it does with newlines I'd expect all kinds of brokenness. |
I might be missing some context. Do you mean that a string would be passed to
That's not easily shareable, but I see it ( |
Ah, if the scripts are all on a single line they won't run into problems, but I don't think enshrining that makes sense for a standard. |
Again, I don't think the TT claim that the values reaching the sinks are semantically correct, only that they were checked before reaching the sinks. |
Sure, but we also store the given value in some internal slot, no? It seems that would mismatch with the value we end up using, which seems bad. |
Yes, but TT also claims that if they've been checked they'll attempt to execute. Which afaict isn't guarunteed for multiline text with innerText. Because we set the internal slot before the processing, and as such the prepareScript function will throw (or at least call the default policy).
If you paste the above data URL into Chrome (with experimental flag for the fromLiteral to work) then it will error rather than execute. That's not an error from .innerText's spec, that's an error from the Trusted Types spec. The fromLiteral isn't relevant it's just the easiest way to write a quick example like this. |
This will be fixed by #533 as it avoids the weirdness with innerTexts newline handling (now uses a flag not a duplication of value) |
A good point came up during code review of an associated webkit patch that the .innerText setter steps and the .textContent/.text setter steps are different, and presumably could result in a different child contents value? If this is the case the current spec (and Chromium implementation) could lead to some script execution errors despite being set via a trusted object and sanctioned IDL attribute?
Question 1: Are these actually identical in behaviour?
Question 2: If they're not should the spec and implementationed be updated to account for the differences?
The text was updated successfully, but these errors were encountered: