[wpt-sync] Sync PR 63200 - Fire securitypolicyviolation for worker/worklet CSP violations
Categories
(Core :: DOM: Security, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 63200 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/63200
Details from upstream follow.
Byungwoo Lee <blee@igalia.com> wrote:
Fire securitypolicyviolation for worker/worklet CSP violations
When CSP violations are detected while fetching a worker's or worklet's
module graph, a securitypolicyviolation event has not been dispatched
since OutsideSettingsCSPDelegate::DispatchViolationEvent() has been a
no-op.Add a proxy method DispatchCSPViolationEvent() to WorkerReportingProxy,
implement the method in MainThreadWorkletReportingProxy for the main
thread worklets, and implement in ThreadedObjectProxyBase and
ThreadedMessagingProxyBase for the threaded workers and worklets.Add a data wrapper CrossThreadSecurityPolicyViolationEventInit to
forward the CSP violation data (SecurityPolicyViolationEventInit)
across threads.This fix covers CSP violations on the module graph fetching for
AudioWorklet, AnimationWorklet, PaintWorklet, LayoutWorklet, and
DedicatedWorker (including nested workers), since they all share the
OutsideSettingsCSPDelegate and a WorkerReportingProxy implementation
that can reach the target context to dispatch the event.
(AnimationWorklet's test expectations are not updated in this CL
since the feature is disabled by default)SharedWorker is not covered by this change. To cover the case, we need
to implement SharedWorkerReportingProxy::DispatchCSPViolationEvent(),
forwarding the violation across processes (via the browser process's
SharedWorkerHost) to the worker's owners.The fix is gated by an experimental runtime-enabled feature,
DispatchWorkerCSPViolationEventForModuleGraphFetching.Low-Coverage-Reason: OTHER No need to test the fallback virtual proxy method that is a no-op.
Bug: 40612680
Force-WPT-Export: true
Change-Id: I977144fd8098dede6ec0ac57d9e03348aca24389
Reviewed-on: https://chromium-review.googlesource.com/8256819
WPT-Export-Revision: 54f27e0f88e5cf088da5196dc01a577652e6a49d
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Comment 1•1 month ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=99862
| Assignee | ||
Comment 2•1 month ago
|
||
CI Results
Ran 9 Firefox configurations based on mozilla-central, and Firefox, and Chrome on GitHub CI
Total 38 tests and 1 subtests
Status Summary
Firefox
OK : 2[GitHub] 35[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS : 113
FAIL : 2[GitHub] 23[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
TIMEOUT: 2
Chrome
OK : 1
FAIL : 1
TIMEOUT: 4
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
New Tests That Don't Pass
- /content-security-policy/securitypolicyviolation/script-sample-no-opt-in.html [wpt.fyi]:
SKIP - /content-security-policy/securitypolicyviolation/script-sample.html [wpt.fyi]:
SKIP - /content-security-policy/securitypolicyviolation/blockeduri-ws-wss-scheme.html [wpt.fyi]
- ws:
FAIL - wss:
FAIL - cross-origin:
FAIL - redirect:
FAIL
- ws:
- /content-security-policy/securitypolicyviolation/inside-nested-dedicated-worker.html [wpt.fyi]:
TIMEOUT(Chrome:TIMEOUT)- CSP violation in nested worker fires securitypolicyviolation event on outer worker.:
TIMEOUT(Chrome:TIMEOUT)
- CSP violation in nested worker fires securitypolicyviolation event on outer worker.:
- /content-security-policy/securitypolicyviolation/source-file.html [wpt.fyi]
- Basic HTTPS URL:
FAIL - Basic HTTP URL:
FAIL - Basic WSS URL:
FAIL - Basic WS URL:
FAIL - Fragment:
FAIL - Query:
FAIL - Port:
FAIL - User:password:
FAIL - User:
FAIL - Invalid URL:
FAIL - file::
FAIL - Custom protocol:
FAIL - about:blank:
FAIL - about:custom:
FAIL - data::
FAIL - blob::
FAIL - javascript::
FAIL
- Basic HTTPS URL:
- /content-security-policy/securitypolicyviolation/worklet-import-nested-cross-origin-blocked.https.sub.html [wpt.fyi]
- CSP violation on a nested import within a PaintWorklet module graph fetch dispatches a securitypolicyviolation event on the Document:
FAIL(Chrome:TIMEOUT)
- CSP violation on a nested import within a PaintWorklet module graph fetch dispatches a securitypolicyviolation event on the Document:
- /content-security-policy/securitypolicyviolation/worklet-import-report-only.https.sub.html [wpt.fyi]
- A CSP violation under report-only policy for a worklet's top-level module script dispatches one securitypolicyviolation event:
FAIL(Chrome:FAIL)
- A CSP violation under report-only policy for a worklet's top-level module script dispatches one securitypolicyviolation event:
Tests Disabled in Gecko Infrastructure
https://hg.mozilla.org/mozilla-central/rev/55fe831d96c7
https://hg.mozilla.org/mozilla-central/rev/6e5ab99ed322
Description
•