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

Clarified the use of the allow-same-origin attribute #1355

Closed
wants to merge 1 commit into from

Conversation

adewale
Copy link
Contributor

@adewale adewale commented Jan 8, 2016

No description provided.

@jmadler
Copy link
Contributor

jmadler commented Jan 8, 2016

cc @Meggin

LGTM. Is there an opportunity to enhance the error message in this case?

@jmadler jmadler self-assigned this Jan 8, 2016
@jmadler jmadler added the LGTM label Jan 8, 2016
@@ -23,7 +23,7 @@ Displays an iframe.
- `amp-iframe` may not appear close to the top of the document (except for `click-to-play` iframes as described below). They must be either 600px away from the top or not within the first 75% of the viewport when scrolled to the top – whichever is smaller. NOTE: We are currently looking for feedback as to how well this restriction works in practice.
- They are sandboxed by default. [Details](#sandbox)
- They must only request resources via HTTPS or from a data-URI or via the srcdoc attribute.
- They must not be in the same origin as the container unless they do not allow `allow-same-origin` in the sandbox attribute.
- They must not be (or expect to be) in the same origin as the container. If you want this behaviour you should add the `allow-same-origin` attribute.
Copy link
Member

Choose a reason for hiding this comment

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

I think this can be further clarified. I'll explain the reason for this rule, since it is in place for DevExp reasons.

Doc X on origin A could load an iframe on origin A and then the iframe could change the doc. But when doc X would be loaded from the AMP cache the its origin would change and the iframe no longer had access, which might break the page.

This is why we want to make the cases where they are on the same origin behave the same as if they weren't. This is not actually for security reasons, since our check can be circumvented with a simple redirect.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see your point, but I'm not sure I see how to implement it. Could you suggest a change?

@rudygalfi
Copy link
Contributor

Filed ampproject/amp.dev#15 to track this

@adewale
Copy link
Contributor Author

adewale commented Feb 6, 2016

Closing this pull request due to the addition of: https://github.com/ampproject/amphtml/blob/master/spec/amp-iframe-origin-policy.md which documents the same thing in more detail.

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.

4 participants