Skip to content

Commit

Permalink
Update Storage Access API integration to match latest spec (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannhof authored Feb 3, 2023
1 parent 0f872c1 commit 9b349f0
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Abstract: How user agents should integrate with First-Party Sets, a mechanism to
Markup Shorthands: markdown yes
Default Biblio Display: inline
</pre>
<pre class=link-defaults>
spec:webidl; type:dfn; text:resolve
</pre>
<pre class="anchors">
spec: PSL; urlPrefix: https://publicsuffix.org/list/
type: dfn
Expand All @@ -25,6 +28,10 @@ spec: clear-site-data; urlPrefix: https://www.w3.org/TR/clear-site-data/#
spec: storage-access; urlPrex: https://privacycg.github.io/storage-access/#
type: dfn
text: determine the storage access policy; url: determine-the-storage-access-policy
<!-- Export PR is https://github.com/w3c/permissions/pull/407, but note that we will likely end up
not using the permissions task source directly, see https://github.com/privacycg/storage-access/issues/144 -->
urlPrefix: https://w3c.github.io/permissions/; spec: permissions
text: permissions task source; url: #permissions-task-source; type: dfn
</pre>
<pre class="biblio">
{
Expand Down Expand Up @@ -174,18 +181,10 @@ To <dfn export>find a first-party set</dfn> for a given [=site=] |site|, run the

Note: The [[SUBMISSION-GUIDELINES]] require that each site can only appear in at most one First-Party set, which is validated at submission time. For this reason, user agents do not need to be concerned with the order of the list of first-party sets when performing these steps.

<h2 id="storage-access-integration">Integration with the Storage Access API</h2>

Define the <dfn>limit for associated sites</dfn> within a single [=first-party set=] to be an [=implementation-defined=] value, which is recommended to be 3.

Note: This limit is used when [=determine eligibility for an associated site|determining eligibility for an associated site=] to only consider the sites listed at the top of the associated subset. It is meant to discourage abuse and help users and user agents understand why a particular first-party set needs to exist. User agents may choose a different number based on this goal.

Modify the [=determine the storage access policy=] step to insert the following steps before step 3 (running [=implementation-defined=] steps):

1. Let |embeddedSite| be the result of [=obtain a site|obtaining a site=] from key’s embedded origin.
2. Let |sameSet| be true if |embeddedSite| is [=eligible for same-party membership when embedded within=] |topLevelSite|.
3. Optionally set implicitly granted or implicitly denied based on the value of |sameSet|. This step is [=implementation-defined=].

A [=site=] |embeddedSite| is <dfn export>eligible for same-party membership when embedded within</dfn> a [=site=] |topLevelSite|, if the following steps return true:

1. Let |set| be the result of [=find a first-party set|finding a first-party set=] for |topLevelSite|.
Expand All @@ -205,6 +204,23 @@ To <dfn>determine eligibility for an associated site</dfn> given a [=site=] |sit
3. If |index| is greater than or equal to the [=limit for associated sites=], return false.
4. Return true.

A given [=environment settings object=] |settings| <dfn>is same-party with its top-level embedder</dfn>, if the following steps return true:
1. Let |topLevelSite| be the result of [=obtain a site|obtaining a site=] from |settings|' [=environment/top-level origin=].
1. Let |embeddedSite| be the result of [=obtain a site|obtaining a site=] from |settings|' [=environment settings object/origin=].
1. Return whether |embeddedSite| is [=eligible for same-party membership when embedded within=] |topLevelSite|.

<h2 id="storage-access-integration">Integration with the Storage Access API</h2>

Modify {{Document/requestStorageAccess()}} to insert the following steps before step 13.5 (i.e. before [=requesting permission to use=]):

1. Let |settings| be <var ignore>doc</var>'s [=relevant settings object=].
1. If |settings| [=is same-party with its top-level embedder=], the user agent may run <var ignore>process permission state</var> with [=permission/granted=] and abort the remaining steps.

Modify {{Document/requestStorageAccessForOrigin(origin)}} to insert the following steps before step 13.8 (i.e. before [=requesting permission to use=]):

1. Let |settings| be <var ignore>doc</var>'s [=relevant settings object=].
1. If |settings| [=is same-party with its top-level embedder=], the user agent may [=queue a global task=] on the [=permissions task source=] given <var ignore>global</var> to [=resolve=] <var ignore>p</var> and abort the remaining steps.

<h2 id="handling-changes">Handling first-party set changes</h2>

When a [=site=] |site| leaves a [=first-party set=] as the result of building a new [=list of first-party sets=], user agents must ensure that it does not retain any access to data or shared identifiers held by other sites in the first-party set by running the following steps:
Expand Down

0 comments on commit 9b349f0

Please sign in to comment.