Closed Bug 2077547 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 63200 - Fire securitypolicyviolation for worker/worklet CSP violations

Categories

(Core :: DOM: Security, task, P4)

task

Tracking

()

RESOLVED FIXED
160 Branch
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

Whiteboard: [wptsync downstream] → [wptsync downstream error]
Component: web-platform-tests → DOM: Security
Product: Testing → Core
Whiteboard: [wptsync downstream error] → [wptsync downstream]

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

Tests Disabled in Gecko Infrastructure

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
You need to log in before you can comment on or make changes to this bug.