Skip to content

Add missing same-site check in document.hasStorageAccess#244

Open
cfredric wants to merge 2 commits intoprivacycg:mainfrom
cfredric:hasStorageAccess
Open

Add missing same-site check in document.hasStorageAccess#244
cfredric wants to merge 2 commits intoprivacycg:mainfrom
cfredric:hasStorageAccess

Conversation

@cfredric
Copy link
Copy Markdown
Contributor

@cfredric cfredric commented Apr 26, 2026

This adds the missing check for an A(B(A)) embedding case in document.hasStorageAccess(), to match the corresponding check in document.requestStorageAccess() (see step 16.7). The effect is that for ABA embeds, after document.requestStorageAccess() is called and resolves, invocations of document.hasStorageAccess() resolve to true.

Fixes #234.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

Copy link
Copy Markdown
Collaborator

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand how this enforces that requestStorageAccess() has previously been invoked. And if this is the right place it seems we can get rid of the previous step as this is a less narrow check.

@cfredric
Copy link
Copy Markdown
Contributor Author

requestStorageAccess() is the main place that sets the environment's has storage access bool, so the new step returns true iff requestStorageAccess() has been called and resolved previously.

Step 10.3.5 (the "same authority" check) handles A(A) embeds, where there is no cross-site ancestor (and therefore third-party cookie blocking isn't relevant). So that check is different and should be kept separately.

Copy link
Copy Markdown
Collaborator

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand now. This seems okay, but one thing we should fix is that we should add "abort these steps" when we resolve while in parallel because it makes no sense to run the subsequent steps as well.

@cfredric
Copy link
Copy Markdown
Contributor Author

Good point, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

document.hasStorageAccess() erroneously always returns false for A(B(A)) embeds

2 participants