Closed Bug 1731990 Opened 3 years ago Closed 2 years ago

Make the Service Worker to use foreignPartitionedPrinicpal for registration, intercept channels and spawning workers in dFPI

Categories

(Core :: Privacy: Anti-Tracking, task)

task

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: timhuang, Assigned: timhuang)

References

Details

Attachments

(5 files)

To partition Service Worker, it has to use the partitionPrincipal to do the registration and spawning workers.

Summary: Make the Service Worker to use partitionPrinicpal for registration and spawning workers in dFPI → Make the Service Worker to use foreignPartitionedPrinicpal for registration, intercept channels and spawning workers in dFPI

This patch changes to use the foreign partitioned principal when check
if a channel needs to be intercepted by a certain service worker.

Assignee: nobody → tihuang
Status: NEW → ASSIGNED

The patch modifies ServiceWorkerContainer::GetScopeForUrl() to use the
foreign partitioned principal.

Depends on D128731

We used to use the principal URL for the partitionKey in
ServiceWorkerPrivateImpl. This is correct if the ServiceWorker only
works in first-party context. But, it isn't correct in third-party
context.

To fix that, we can directly use the foreign paritioned principal from
the ServiceWorkerPrivate to get the partitionKey in third-party context.
For the first-party context, we can still use the original approach to
get the partitionKey.

Depends on D128732

This patch changes ServiceWorkerScriptCache to use the principal of the
service worker to populate the partitionKey to the cookieJarSettings.
The service workers are using foreign partitioned principal. This means
it will contain a correct partitionKey if it's in a third-party context.
So we can use it to populate the partitionKey. In the first-party
context, we can use the script uri to get the partionKey, which is the
original approach.

Depends on D128733

Pushed by tihuang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/97d6cf760a47
Part 1: Using ForeignPartitionedPrincipal in ServiceWorkerInterceptController. r=asuth
https://hg.mozilla.org/integration/autoland/rev/738670a0e276
Part 2: Using foreignPartitionedPrincipal in ServiceWorkerContainer. r=asuth
https://hg.mozilla.org/integration/autoland/rev/f023cff11d39
Part 3: Use the partitionKey from the foreign partitioned principal in ServiceWorkerPrivate. r=pbz,dom-storage-reviewers,edenchuang
https://hg.mozilla.org/integration/autoland/rev/c6c7c0aa9519
Part 4: Populate the partitionKey from the prinicpal of the service worker in ServiceWorkerScriptCache. r=asuth
https://hg.mozilla.org/integration/autoland/rev/dd8df905c0a8
Part 5: Add tests for partitioned third-party service worker. r=pbz
Regressions: 1768193
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: