-
Notifications
You must be signed in to change notification settings - Fork 28
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
Should opener be taken into consideration when determining if a context is secure? #42
Comments
Additionally, imagine <a href="http://example.com/worker" target="_blank">Click me</a> If the link above is clicked, |
As @mikewest says, |
It'd be great to see numbers for "window.opener used from an HTTPS page to an HTTP page" - could we deprecate in this case? |
Arg, sorry I missed this when you filed it. Thanks for the ping. So. Heresy or not, I'm also not thrilled with the The general idea behind the opener restriction is to close down communication channels between secure origins and non-secure origins in order to prevent feature use in one context from leaking into another. As you note (and as described in https://w3c.github.io/webappsec-secure-contexts/#isolation), a number of communication side-channels exist for same-origin content that we haven't addressed via this restriction. Those side channels are hampered by the fact that no direct DOM access exists between the contexts, but they exist as long as we don't use the context's "secure" status to influence the origin (which I'm very reluctant to consider). That said, the same side- and direct-channels exist for Still, I'm totally sympathetic to the notion that we shouldn't punish innocent bystander sites to which a user legitimately wants to navigate. Since direct DOM access worries me much more than side-channel access, perhaps we could take the opener context's origin and content into consideration more than we do today. A pretty ugly strawman would be something like "If there's a non-secure view onto the openee's origin (or an origin which has opted into same-originness via I'd suggest that we can pursue a three-pronged approach here:
(/cc @annevk @bifurcation @hillbrad @jwatt) |
1, in particular w3c/webappsec#517 seems good (basically a signal that you want to become a new top-level browsing context rather than auxiliary, also useful if you want independent process benefits and such). @bifurcation can be pinged through @rlbmoz. |
@annevk: Yeah. A stub of that is in CSP3: https://w3c.github.io/webappsec-csp/#directive-disown-opener |
I tend to agree with the ordered approach above. The more often a window can be legitimately disowned (via cross-origin navigation, or one of the opt-in options mentioned) the better, and allows for more opportunities for strong isolation in the UA (e.g., process isolation hinted at by Anne above). If these options help to re-set the "inherited" (in)secure context flag for that new window, then, that's just further incentive for site authors to apply it. So, I don't have issue with the way the secure context flag is extended to opener windows today. |
The difference between a window & an iframe is the origin that's displayed in the URL bar. It seems fine to limit iframes because the user can be unaware that the framed origin is executing code. In regards to postmessaging, could this have been tackled as part of MIX? As in, signal a drop in security if a mixed communication happens, and allow CSP to prevent mixed communication? w3c/webappsec#517 will solve this for geolocation & such, but it won't solve it for service worker. We need to know if the site's SW can handle the navigation fetch, and at that point we don't know if the site is going to drop We may drop |
Do they generally use |
Origin policy?
I would be pretty happy with this resolution. |
An origin policy would work here also. But I think we'll auto-disown opener if opener is a non-secure context. Happy for this to close if you are. |
Sure. I'll leave the bit as "at risk" in the spec just in case we can come up with something better, but happy to close this for the moment. |
Actually, let's leave this open, just for visibility. |
This is causing us angst. We've been using the "is a secure context" state to warn about entering passwords on insecure pages. As a result we have confused users wondering why some of their https:// pages are warning them that submitting their password is insecure. It looks secure when they look at the url bar. Very hard to convince them that "the page might pass information insecurely via its opener" makes the page insecure. The site might be storing passwords in plain text in a world-readable file once they are securely transmitted. Of course we could decide passwords are a special case and determine secureness differently, but if we're having trouble explaining this insecure-secure-site case to users maybe developers aren't going to get it either. If anything I'd rather just nullify opener by default if we think this is a significant case we need to stop, and make sites specify explicit rel=insecureopener to get it back (and then treat the spawned context as insecure). |
@dveditz: We don't tie mixed content checks to the context being "secure", only to it being delivered over a secure transport. The password check you're talking about in Firefox seems much more similar to a mixed content check than to a "should this API be available at all" check. shrug |
For the record, as of Firefox 52 we added a privileged-code-only |
As it is now I think everything in Gecko should use |
https://bugs.webkit.org/show_bug.cgi?id=158121 <rdar://problem/26012994> Reviewed by Alex Christensen. Part 2 Implements the Secure Contexts spec., <https://w3c.github.io/webappsec-secure-contexts/> (Editor's Draft, 17 November 2016) except for the allow-secure-context sandbox flag and restrictions on window.opener as the former is at risk of being dropped from the specification and the latter is being discussed in <w3c/webappsec-secure-contexts#42>. We are not making use of the Secure Contexts functionality at the moment. We will make use of it in a subsequent commit. * dom/Document.cpp: (WebCore::Document::isSecureContext): Added, * dom/Document.h: * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::isSecureContext): Deleted; moved to class SecurityContext. * dom/SecurityContext.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::isSecureContext): Added. * page/DOMWindow.h: * page/SecurityOrigin.cpp: (WebCore::isLoopbackIPAddress): Convenience function to determine whether the host portion of the specified URL is a valid loopback address. (WebCore::shouldTreatAsPotentionallyTrustworthy): Implements the "Is origin potentially trustworthy?" algorithm from the Secure Context specification. (WebCore::SecurityOrigin::SecurityOrigin): Compute whether this origin is potentially trustworthy. Also, use C++ brace initialization syntax in member initialization list. * page/SecurityOrigin.h: (WebCore::SecurityOrigin::isPotentionallyTrustworthy): Added. * page/WindowOrWorkerGlobalScope.idl: Expose attribute isSecureContext. Fix style nit; remove period from a comment that is not meant to be a complete sentence. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::isSecureContext): Added. * workers/WorkerGlobalScope.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@218028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
I screwed this up in Chrome, sorry for both the angst and the churn. I've dropped the section from the spec, which brings it into line with everyone's implementations. My apologies. :( |
As @jonathanKingston pointed out and also illustrated by the comment from @jwatt above, Firefox does actually implement this. We have https://bugzilla.mozilla.org/show_bug.cgi?id=1410364 to align with the changed standard. It would be good if there were tests. |
We have tests; @jwatt added them when we implemented in Firefox. See http://w3c-test.org/secure-contexts/ It looks like @mikewest already updated those tests in web-platform-tests/wpt@dd83f89 |
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations. --HG-- extra : rebase_source : 3d7fa73976571f357e84e369093aecfc10c5872e extra : amend_source : ca86714f357b653577f3186b6312bfa00f1f45b9
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations.
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations.
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations.
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations.
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations. UltraBlame original commit: 681fece780aef771f1c6b56cddf4e52c8c800cb2
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations. UltraBlame original commit: 6784a27f54ff76952569067bab6e34c443e48c84
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations. UltraBlame original commit: 681fece780aef771f1c6b56cddf4e52c8c800cb2
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations. UltraBlame original commit: 6784a27f54ff76952569067bab6e34c443e48c84
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations. UltraBlame original commit: 681fece780aef771f1c6b56cddf4e52c8c800cb2
… r=bz, r=dveditz Per w3c/webappsec-secure-contexts#42, the section considering the window opener when calculating secure context is to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in most places as this is the actual behavior we want. This patch aligns with the upcoming spec changes by ignoring the window opener. We also no longer have to keep information about whether our opener was secure as that no longer factors in our calculations. UltraBlame original commit: 6784a27f54ff76952569067bab6e34c443e48c84
Ok, I know this is going to sound like heresy, but I'm thinking a window opened by a non-secure context via
window.open
or<a target="_blank">
should still be considered a secure context.I agree that an HTTPS iframe embedded in an HTTP page should not be considered secure, since that gives you an invisible and automatic way of creating a channel between the two, but
window.open
and<a target="_blank">
are visible, and both require a user interaction.Imagine
http://example.com
contains:The iframe is non-secure, but the opened tab is secure. The secure opened tab can perform secure actions, and send it to the non-secure iframe via any origin storage,
BroadcastChannel
, or in a hacky waySharedWorker
(since its security is decided by the document which creates it).If we drop the parts of the spec that take
opener
into account when deciding if the context is secure users get a more consistent experience when following links, as their seemingly top-level contexts are consistently able to access powerful features.The alternative, to combat the above, is to add
isSecureContext
to the origin identifier. Meaning otherwise secure contexts opened viatarget="_blank"
are a different origin to contexts opened to the same URL viatarget="_blank" rel="noopener"
. But that exacerbates the weird user experience.The text was updated successfully, but these errors were encountered: