Closed Bug 1731988 Opened 3 years ago Closed 3 years ago

Introduce a new helper function for always partitioned storage to select the correct principal

Categories

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

task

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: timhuang, Assigned: timhuang)

References

Details

Attachments

(5 files)

To support different cookieBehavior, we need to have a helper function for selecting the correct principal for ServiceWorker. For example, we need to use the partitionPrincipal in the dFPI(CookieBehaivor 5) for the third-party context, but not for the first-party context. Also, we will still use regular principal in ETP(CookieBehavior 4).

As we are going to always partition ServiceWorker in dFPI, there are some adjustments that will be made which are different from the comment 0. I will outline the details that I want to do as following.

First, we will need a general helper function to get the right principal for partitioned third-party storage, such as service workers. And this should not consider the storage access permission because it will be always partitioned even the third party gets the storage access. To achieve this, a new StoragePrincipalHelper::PrincipalType will be added. I plan to call it ForeignPartitionedPrincipal. A foreign partitioned principal will stay partitioned for third-party contexts regardless of the storage access and will be regular principal if it's a first-party context.

Second, the ForeignPartitionedPrincipal is dFPI only, meaning that it will still return a regular principal for a third-party context if dFPI is disabled.

Third, I will add a StoragePrincipalHelper::GetPrincipal() helper function to get the right principal. It will be used by ServiceWorker to get the principal.

Assignee: nobody → tihuang
Status: NEW → ASSIGNED
Summary: Intorduce a new helper function for ServiceWorker to select the correct principal according to the StorageAccess → Intorduce a new helper function for always partitioned storage to select the correct principal

In order to support always partitioned third-party storage,
like the service worker, in the future, we need to have another
principal type which uses partitioned principal in a third-party context
and regular principal in a first-party context.

This patch implements the StoragePrincipalHelper::GetPrincipal() which
is designed to be used to get the principal from the window/channel
according to the given principal type.

Depends on D127436

This patch adds tests for the StoragePrincipalHelper::GetPrincipal() but
only for the version which accepts a channel. The reason why we don't
add tests for window version is because there is no way to setup window
in gTest.

Depends on D127438

Pushed by tihuang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/beb4cde1da17
Part 1: Add a new PrincipalType `eForeignPartitionedPrincipal` for StoragePrincipalHelper. r=dimi
https://hg.mozilla.org/integration/autoland/rev/0817d1be30ec
Part 2: Support eForeignPartitionedPrincipal for StoragePrincipalHelper::GetOriginAttributes(). r=dimi
https://hg.mozilla.org/integration/autoland/rev/4e89e8ed9461
Part 3: Implement StoragePrincipalHelper::GetPrincipal() functions. r=dimi
https://hg.mozilla.org/integration/autoland/rev/828ae1384836
Part 4: Add gTest for the StoragePrincipalHelper::GetPrincipal(). r=dimi
https://hg.mozilla.org/integration/autoland/rev/ef7b596bb385
Part 5: Updatet the documentation in StoragePrincipalHelper.h r=dimi
Summary: Intorduce a new helper function for always partitioned storage to select the correct principal → Introduce a new helper function for always partitioned storage to select the correct principal
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: