Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential bug in access delegation to cross-origin iframe for feature that has default allowlist value "self"? #512

Closed
shuranhuang opened this issue May 8, 2023 · 2 comments · Fixed by #517

Comments

@shuranhuang
Copy link
Contributor

According to the explainer, when no declared policy presents, a powerful features that has default allowlist value "self" should be allowed in the top-level document and its same-origin frames, but blocked in cross-origin frames, unless allow attribute is used to set this policy and the origin of the document in the frame matches the iframe's src attribute.

However, the following step from the "Define an inherited policy for feature in container at origin" algorithm,

1. If the result of executing <a abstract-op>Is feature
enabled in document for origin?</a> on |feature|, |container|'s
<a>node document</a>, and |origin| is "<code>Disabled</code>",
return "<code>Disabled</code>".

which steps into "Is feature enabled in document for origin?" algorithm to the following steps
1. If |feature|'s <a>default allowlist</a> is <code>'self'</code>, and
|origin| is [=same origin=] with |document|'s origin, return
"<code>Enabled</code>".
1. Return "<code>Disabled</code>".

will return "Disabled" for the case mentioned at the beginning, where "Enabled" is expected.

Could this be a bug or I am missing something here?

@shuranhuang shuranhuang changed the title Potential bug in access delegation in cross-origin iframe for feature that has default allowlist value "self"? Potential bug in access delegation to cross-origin iframe for feature that has default allowlist value "self"? May 8, 2023
@clelland
Copy link
Collaborator

That does seem like a bug -- that step should be checking to see if the feature can potentially be delegated to the child frame, or if it is blocked by the policy in the containing document. Either 9.8 needs to return Enabled in all default cases, or 9.7 should be calling something different in this step.

This algorithm needs to be rewritten to handle #480 as well, so I'll see if I can come up with text that fits that and matches the intended behavior for default-self inheritance.

@shuranhuang
Copy link
Contributor Author

shuranhuang commented May 26, 2023

Thanks for confirming! I think this issue was first introduced in #501. The fix should be easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants