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

Data URL iframes are considered secure contexts only if sandboxed #83

Closed
letitz opened this issue Jan 11, 2021 · 5 comments
Closed

Data URL iframes are considered secure contexts only if sandboxed #83

letitz opened this issue Jan 11, 2021 · 5 comments

Comments

@letitz
Copy link
Member

letitz commented Jan 11, 2021

Hi there!

I stumbled across this initially when looking at the web platform tests for secure contexts and inheritance. The secure-contexts/basic-popup-and-iframe-tests.https.html test exhibits two failures.

The test asserts that data: iframes inherit their parent's isSecureContext bit, whether they are sandboxed or not.

The results show otherwise:

  • origin-sandboxed iframes loaded from a data: URL only inherit their parent's isSecureContext bit in Safari
  • non-origin-sandboxed iframes loaded from a data: URL are never secure

Indeed, it seems only Safari correctly implements the spec here. According to the spec (simplifying for clarity in this case):

  • origin-sandboxed iframes check if their creation URL is potentially-trustworthy
    • data: URLs are considered potentially-trustworthy
  • non-origin-sandboxed iframes check if their origin is potentially-trustworthy
    • data: URLs have opaque origins, which are not considered potentially-trustworthy

It seems strange that sandboxed iframes would be considered more secure than their non-sandboxed siblings. I think this strange state of affairs resulted from changes made for #26 and #69.

@annevk
Copy link
Member

annevk commented Jan 11, 2021

https://html.spec.whatwg.org/#secure-contexts supersedes the definition here.

@domenic @sideshowbarker what do you think about updating this specification? I'm happy to review patches, or submit a patch for review. I think Mike and I can land patches so even if this is effectively unowned we could still add some clarity.

@domenic
Copy link
Contributor

domenic commented Jan 11, 2021

That'd be great. I was willing to do that a while ago, but the fact that there's so many open PRs (including e.g. basic ones like #76) discouraged me.

For division of work, I'd be happy to work on updating the pointers to HTML and removing the now-redundant algorithms, but would rather someone else tackle any of the non-normative bits.

@letitz
Copy link
Member Author

letitz commented Jan 11, 2021

Oh, I see. Thanks for the pointer to the current spec in HTML, I was unaware of it...

@sideshowbarker
Copy link
Contributor

@domenic @sideshowbarker what do you think about updating this specification? I'm happy to review patches, or submit a patch for review. I think Mike and I can land patches so even if this is effectively unowned we could still add some clarity.

I think updating it would be a great thing — and we have a clear way open to make it happen, so yeah, let’s move forward with it

domenic added a commit to domenic/webappsec-secure-contexts that referenced this issue Jan 11, 2021
annevk pushed a commit that referenced this issue Jan 12, 2021
See #83.

(Also remove a line from .travis.yml that does not appear to be needed and caused the build to fail.)
@annevk
Copy link
Member

annevk commented Jan 12, 2021

Solved by #84. Thanks for the reminder that this needed cleanup @letitz!

@annevk annevk closed this as completed Jan 12, 2021
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

No branches or pull requests

4 participants