Closed Bug 1936058 Opened 2 months ago Closed 2 months ago

Add WPT invalidation test for the require-trusted-types-for CSP directive

Categories

(Core :: DOM: Security, task)

task

Tracking

()

RESOLVED FIXED
135 Branch
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).

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.

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: mbrodesser → nobody
Assignee: nobody → mbrodesser

(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.

Pushed by mbrodesser@igalia.com: https://hg.mozilla.org/integration/autoland/rev/8f2d558f4720 add WPT for checking removing the meta tag of a "require-trusted-types-for 'script'" directive continues requiring trusted types. r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/49705 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch
Upstream PR merged by moz-wptsync-bot
Blocks: 1939805
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: