Add WPT invalidation test for the require-trusted-types-for CSP directive
Categories
(Core :: DOM: Security, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox135 | --- | fixed |
People
(Reporter: fredw, Assigned: mbrodesser-Igalia)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file)
In bug 1909168, we are basically caching whether a document / CSP policy list contains at least one require-trusted-types-for-csp directive.
Mirko pointed out that we likely need invalidation tests for that optimization if someone dynamically modifies the CSP list so that it ends up including or not a require-trusted-types-for-csp directive. I don't really know when/if that can happen (e.g. perhaps by modifying the meta tags) but agree this is definitely something to double check. Perhaps also for workers if we end up needing a similar optimization (I'll explain on bug 1936014).
Assignee | ||
Comment 1•2 months ago
|
||
I don't really know when/if that can happen (e.g. perhaps by modifying the meta tags)
Yes. A test adding CSP, like https://jsbin.com/fuwuremuse/1/edit?html,output is needed. Analogously another test which removes the CSP.
Assignee | ||
Comment 2•2 months ago
|
||
Another scenario potentially needing tests: two CSPs, one "Content-Security-Policy" and one "Content-Security-Policy-Report-Only" and the different combinations of adding/removing them.
Assignee | ||
Updated•2 months ago
|
Assignee | ||
Updated•2 months ago
|
Assignee | ||
Comment 3•2 months ago
|
||
Codepaths for "trusted-types somePolicyName" [1] are likely the same, so
adding no tests for that.
[1] https://www.w3.org/TR/trusted-types/#trusted-types-csp-directive
Assignee | ||
Comment 4•2 months ago
|
||
(In reply to Mirko Brodesser (:mbrodesser-Igalia) from comment #2)
Another scenario potentially needing tests: two CSPs, one "Content-Security-Policy" and one "Content-Security-Policy-Report-Only" and the different combinations of adding/removing them.
More specifically, two directives for one document were meant. Such a test seems unnecessary, because only "require-trusted-types-for 'script'" directives are relevant here. So the relevant code-path is the one for such a directive, for which already tests exist.
Description
•