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 for policies with disposition=report in workers #575

Closed
fred-wang opened this issue Jan 15, 2025 · 5 comments · Fixed by web-platform-tests/wpt#51522
Closed

Add test for policies with disposition=report in workers #575

fred-wang opened this issue Jan 15, 2025 · 5 comments · Fixed by web-platform-tests/wpt#51522

Comments

@fred-wang
Copy link
Collaborator

Looking for "Content-Security-Policy-Report-Only", I can't find any test related to workers:

find -type f | xargs grep 'Content-Security-Policy-Report-Only'
./trusted-types-reporting.html.headers:Content-Security-Policy-Report-Only: trusted-types two; report-uri /content-security-policy/resources/dummy-report.php
./trusted-types-reporting-check-report.html.sub.headers:Content-Security-Policy-Report-Only: trusted-types one two; report-uri /reporting/resources/report.py?op=put&reportID={{$id}}
./trusted-types-eval-reporting-report-only.html:  //   Content-Security-Policy-Report-Only: require-trusted-types-for 'script'
./trusted-types-report-only.html.headers:Content-Security-Policy-Report-Only: trusted-types two; report-uri /content-security-policy/resources/dummy-report.php; require-trusted-types-for 'script';
./trusted-types-duplicate-names-list-report-only.html.headers:Content-Security-Policy-Report-Only: trusted-types a b c
./support/navigation-report-only-support.html.headers:Content-Security-Policy-Report-Only: require-trusted-types-for 'script';
./trusted-types-report-only.html:  //   Content-Security-Policy-Report-Only: trusted-types ...; report-uri ...
./no-require-trusted-types-for-report-only.html.headers:Content-Security-Policy-Report-Only: require-trusted-types-for 'script'
./trusted-types-reporting-check-report.html:  Content-Security-Policy-Report-Only: \
./empty-default-policy-report-only.html.headers:Content-Security-Policy-Report-Only: require-trusted-types-for 'script';
./require-trusted-types-for-report-only.html.headers:Content-Security-Policy-Report-Only: require-trusted-types-for 'script'
./trusted-types-duplicate-names-list-report-only.html:// Content-Security-Policy-Report-Only: trusted-types a b c
./default-policy-report-only.html.headers:Content-Security-Policy-Report-Only: require-trusted-types-for 'script';
./trusted-types-eval-reporting-report-only.html.headers:Content-Security-Policy-Report-Only: require-trusted-types-for 'script'
./trusted-types-reporting.html:  //   Content-Security-Policy-Report-Only: trusted-types two; report-uri ...

This is used for the following algorithms:

@fred-wang
Copy link
Collaborator Author

cc @lukewarlow

@fred-wang
Copy link
Collaborator Author

We now have much more tests at trusted-types/should-trusted-type-policy-creation-be-blocked-by-csp-*.html ; but still they don't involve workers.

@annevk
Copy link
Member

annevk commented Mar 7, 2025

In case someone else was wondering: importScripts() is gated by Trusted Types.

@fred-wang
Copy link
Collaborator Author

In case someone else was wondering: importScripts() is gated by Trusted Types.

Right, a list of TT sinks can be found here: #494 (comment)

So the ones that can run in workers are:

  • eval/new Function
  • setTimeout/setInterval
  • importScripts
  • Worker's constructor (from DedicatedWorker/SharedWorker only)
  • ServiceWorkerContainer's register

@fred-wang
Copy link
Collaborator Author

I believe @lukewarlow added complete sink coverage for disposition=enforce. I guess we need at least one case for Content-Security-Policy-Report-Only in worker (maybe eval and another one).

fred-wang added a commit to web-platform-tests/wpt that referenced this issue Mar 21, 2025
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Mar 23, 2025
… complex CSP list., a=testonly

Automatic update from web-platform-tests
Add TT violation checks for workers with complex CSP list. (#51522)

Closes w3c/trusted-types#574
Closes w3c/trusted-types#575
--

wpt-commits: 1bd696a0e8e8225ea33218b9bafbc6ccfd37b8b5
wpt-pr: 51522
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this issue Mar 26, 2025
… complex CSP list., a=testonly

Automatic update from web-platform-tests
Add TT violation checks for workers with complex CSP list. (#51522)

Closes w3c/trusted-types#574
Closes w3c/trusted-types#575
--

wpt-commits: 1bd696a0e8e8225ea33218b9bafbc6ccfd37b8b5
wpt-pr: 51522
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Mar 28, 2025
… complex CSP list., a=testonly

Automatic update from web-platform-tests
Add TT violation checks for workers with complex CSP list. (#51522)

Closes w3c/trusted-types#574
Closes w3c/trusted-types#575
--

wpt-commits: 1bd696a0e8e8225ea33218b9bafbc6ccfd37b8b5
wpt-pr: 51522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants