-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Consider blocking downloads from a sandboxed <iframe>
.
#3236
Comments
(And also folks who should probably be in that group, like @dveditz, @johnwilander, @patrickkettner, @bzbarsky, @ckerschb, @arturjanc, @dbates-wk) |
(I've invited those in your list that were not already invited to join the team. For anyone curious, the way we use teams is documented here: https://github.com/whatwg/meta/blob/master/GITHUB-TEAMS.md.) |
Seems plausible to me, especially if we can get some telemetry on how often this is used in practice right now. I expect not too much. |
I am worried about breaking existing clients during the transition. But maybe the telemetry can say how often its being used. I also think we could mitigate this risk by saying "allow downloads only if allow-top-navigation or allow-popups is set". If someone's setting those two flags, not allowing downloads seems weird. I dislike how the list of keywords for sandbox keeps growing. |
Yes, I agree that we need to collect some telemetry first.
@devd One concern is that malicious ads (in sandbox usually with 'allow-popups' to allow new pages to be opened) are automatically downloading say, APKs on user device, and it would not be able to block such behaviors. |
I forget the spec ... does the popup inherit the sandbox? If not, can't the popup allow the download? |
Yes, unless you set |
|
As @bzbarsky said, the popup inherits the sandbox unless you set allow-popups-to-escape-sandbox. But auto popup would be blocked by popup blockers that most browsers have, while auto download won't. So popups are guarded by user gestures (interactions), but not downloads. |
Hi folks, I’m looking to spec out the details and add that to Chrome. Here’s my proposal: We are targeting to prevent only downloads that doesn’t involve a user gesture, which include synthetic This implies: Alt-Click, Drag-And-Drop, Context Menu triggered download won’t be blocked. Top-level-navigation to a download won’t be blocked. The reason to allow top level navigation to a download is: 1) it’s a clear mechanism to spec out, as this is implied by the fact that top navigation doesn't inherit the sandbox; on the other hand, popup to a download will be blocked as it inherit the sandbox. 2) sandbox already disallow top-level-navigation, and if the client opt in, it makes sense to trust it regardless whether it results in a download or not. I'm happy to see what people are thinking. |
We use “-by-user-activation” when that’s a requirement for the capability. Should we say “allow-download-without-user-activation” here? |
sounds reasonable to me |
Hmm, aren't all sanbbox allow-X flags implicitly "without user activation"? Is there a reason to be more explicit with this one? |
I looked at the spec, the only flags involving the notion of user activation is:
If we single out the 1st one, the "allow" keyword is implicitly "without user activation", but looking them together it's not necessarily so. But it does suggest another option which is to use 2 flags and keywords in the same way as "top-level navigation" does. Here are some options and my thoughts:
I personally is in favor of 1) for simplicity, but all options make sense to me. Happy to know what other people think. |
I meant all the others. I.e. we say allow-scripts, not allow-scripts-without-user-activation. Etc. We don't involve the concept of user activation (even in the flag name) except in the one case of top navigation, where we have both and need to contrast the two. |
My proposal of the restriction was targeting at just to prevent download without user activation (the definition of that is either the navigation-to-download is without user activation, or |
Oh, I see. Sorry, I completely missed that key point from your original post... somehow. In that case I think including -without-user-activation makes perfect sense, and I apologize for wasting time on the back and forth. |
Follow the proposal discussed in whatwg/html#3236. Bug: 539938 Change-Id: I1841eb1f3c1f121586eed5a08e7e0e9f94ec4430 Reviewed-on: https://chromium-review.googlesource.com/c/1413377 Commit-Queue: Yao Xiao <yaoxia@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#625878}
Drive-by comment: would the sandboxed window have a way to know that the download failed? |
I'm thinking giving devtool messages, similar to what Chrome currently does when blocking the top-navigation, popups, etc. |
…| and relevant specifications. Add |sandboxed download without user activation browsing context flag| and relevant specifications. See whatwg#3236 for more context.
…| and relevant specifications. Add |sandboxed download without user activation browsing context flag| and relevant specifications. See whatwg#3236 for more context.
cc @ehsan : I'm interested to see if FireFox is interested in implementing, so that the spec change review can be moved forward. Unconfirmed bug on Firefox. |
@xyaoinum if we think it's reasonable to disable this retroactively, why do we need |
The opt-in feature was originally proposed for compat concern (i.e. was not explicitly asked by any web developer). But from Chrome's statistics collected later, we do have seen both legitimate & abusive cases: Legitimate: Abusive: The "drive-by download in sandbox" behavior is seen on 0.002% page loads, and it's estimated that about 70% of those are abusive cases. Therefore, I think the best thing to do is to intervene by default, and give options to lift the restriction. |
Intent to Implement: https://groups.google.com/a/chromium.org/d/msg/blink-dev/JdAQ6HNoZvk/xvDKF3GyDgAJ whatwg/html issue: whatwg/html#3236 Bug: 539938 Change-Id: I0abeb1bb462806a65468b25cb30e5cb82f68cafb
Intent to Implement: https://groups.google.com/a/chromium.org/d/msg/blink-dev/JdAQ6HNoZvk/xvDKF3GyDgAJ whatwg/html issue: whatwg/html#3236 Bug: 539938 Change-Id: I0abeb1bb462806a65468b25cb30e5cb82f68cafb
Intent to Implement: https://groups.google.com/a/chromium.org/d/msg/blink-dev/JdAQ6HNoZvk/xvDKF3GyDgAJ whatwg/html issue: whatwg/html#3236 Bug: 539938 Change-Id: I0abeb1bb462806a65468b25cb30e5cb82f68cafb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872306 Commit-Queue: Yao Xiao <yaoxia@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Bryan McQuade <bmcquade@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#718560}
Intent to Implement: https://groups.google.com/a/chromium.org/d/msg/blink-dev/JdAQ6HNoZvk/xvDKF3GyDgAJ whatwg/html issue: whatwg/html#3236 Bug: 539938 Change-Id: I0abeb1bb462806a65468b25cb30e5cb82f68cafb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872306 Commit-Queue: Yao Xiao <yaoxia@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Bryan McQuade <bmcquade@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#718560}
Intent to Implement: https://groups.google.com/a/chromium.org/d/msg/blink-dev/JdAQ6HNoZvk/xvDKF3GyDgAJ whatwg/html issue: whatwg/html#3236 Bug: 539938 Change-Id: I0abeb1bb462806a65468b25cb30e5cb82f68cafb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872306 Commit-Queue: Yao Xiao <yaoxia@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Bryan McQuade <bmcquade@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#718560}
@annevk : There are both legit cases and abusive cases right now - roughly half and half. To restrict by default would help with abusive cases like automatic download from advertisement. And I can imagine some embedders want to just allow download while restricting other behaviors. e.g. embedded video converter sites . |
…owing all downloads, a=testonly Automatic update from web-platform-tests Change sandbox download policy to disallowing all downloads Intent to Implement: https://groups.google.com/a/chromium.org/d/msg/blink-dev/JdAQ6HNoZvk/xvDKF3GyDgAJ whatwg/html issue: whatwg/html#3236 Bug: 539938 Change-Id: I0abeb1bb462806a65468b25cb30e5cb82f68cafb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872306 Commit-Queue: Yao Xiao <yaoxia@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Bryan McQuade <bmcquade@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#718560} -- wpt-commits: 22d4bec70c4dc2572fce851a8cea3c0d5c7f5489 wpt-pr: 19983 --HG-- rename : testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_anchor_download_block_downloads_without_user_activation.sub.tentative.html => testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_anchor_download_block_downloads.sub.tentative.html rename : testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_block_downloads_without_user_activation.sub.tentative.html => testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigation_download_block_downloads.sub.tentative.html
…owing all downloads, a=testonly Automatic update from web-platform-tests Change sandbox download policy to disallowing all downloads Intent to Implement: https://groups.google.com/a/chromium.org/d/msg/blink-dev/JdAQ6HNoZvk/xvDKF3GyDgAJ whatwg/html issue: whatwg/html#3236 Bug: 539938 Change-Id: I0abeb1bb462806a65468b25cb30e5cb82f68cafb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872306 Commit-Queue: Yao Xiao <yaoxia@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Bryan McQuade <bmcquade@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#718560} -- wpt-commits: 22d4bec70c4dc2572fce851a8cea3c0d5c7f5489 wpt-pr: 19983
I guess I'd like to see something stronger. How many embedders would adopt this new value? |
@annevk : We reached to a few sites (15+) on the top of the list and only developers from AOL and Google responded. And they both have adopted / are ready to adopt the change. I think many embedders haven't adopted the new value only because they're not aware of the change, as I see no reason they wouldn't adopt if download is expected to be a legitimate use case on the embedded site. And the cost of adopting is also trivial. I feel standardizing this is a step forward to make more developers aware of it. |
@annevk / @dveditz : Want to confirm if this aligns with your thoughts: Compared to allow-downloads, were you saying you would be in favor of allow-downloads-with-gesture or "no allow- token at all"? And what kind of justification do you need to answer "How many embedders would adopt this new value"? I think we could do the latter options and let those intervened download to be resumable through a browser UI as a last resort to the breakages (repeated below for reference). ~0.002% page loads are having those legitimate download without gesture in sandbox:
|
friendly ping @annevk and @dveditz . Please let me know if you prefer other options over the proposed option - to block all downloads in sandbox and to use "allow-downloads" to opt-out. Or, as Domenic pointed out in the latest spec review, if you don't have strong objection but are just uncertain about how embedders would react, maybe it's reasonable for Chrome trying to ship the restriction, and if it's web-compatible we can then proceed with the spec change? |
FWIW, I'm in favor of starting with |
Hi folks 👋, (With all due apologies for posting on a closed ticket), over at Observable, we run a platform that allows our notebook authors to write arbitrary JavaScript within sandboxed iframes, and folks that use Chrome Canary are beginning to be affected by this change. I imagine that the JSBins and Codepens and their friends and family will begin running into this soon as well. In general, we want to give our users as much of the power of the web platform as possible (in a sandboxed iframe), while maintaining the basic security rules that make normal web pages less dangerous. Not allowing drive-by downloads is definitely one of them! Because the Any interest in giving |
Thanks for the report and question. Are you confident that the required user gesture would cover the use cases your users have? Could you describe some example use cases? |
Happy to. In general, we would like to allow our users to create notebooks that allow readers to download computed content — images, CSV files, JSON, generated SVGs, and so on. We currently provide a Here’s a coronavirus tracking graphic that allows readers to download the source data that backs it as a TSV formatted text file: https://observablehq.com/@elaval/coronavirus-worldwide-evolution Here’s an npm package dependency visualizer notebook that allows you to download the resulting graphviz image as either an SVG or PNG file: https://observablehq.com/@mbostock/package-dependencies Here’s a fancy exploration of building buckyball models out of toilet paper tube strips, which includes an interactive simulation, which you can manipulate and then download the currently configured graph as a JSON file: https://observablehq.com/@rreusser/toiletpaperfullerenes-and-charmin-nanotubes Here’s a "chart-o-matic", where you can edit the textarea to generate a different bubble map, and then download the resulting image as a PNG or SVG: https://observablehq.com/@mbostock/bubble-o-matic We would like to allow authors to create download links, buttons and interactions in their sandboxed iframes, without also allowing malicious drive-by downloads, triggered immediately upon loading a notebook. Here’s an example of a notebook where an author is using a simulated "click" event to force a download of a small SVG: https://observablehq.com/@msurguy/untitled/3 We’d like to use something like |
Since this is closed, it would be better if this moved into a new dedicated issue for that feature. |
@annevk Is that something you’d like me to do? Or is it better if WhatWG contributors open new tickets for previously debated issues? |
@jashkenas since you have the novel use case it'd be great if you could do it. When there's new information it's always cool to open a new issue. |
Discussion moved to: #5513 |
Guys, I am the author of www.Photopea.com . It is a photo editor, which is used by about 8 million people per month. There are several hundreds of schools, who use it at their website in <iframe>. This way, Photopea checks the URL of the parent frame and hides ads in the editor (they can not use my main version at www.Photopea.com because of ads). Since the latest Chrome release, Photopea in iframe can not save files to the computer. I am receiving about 4 emails per hour from teachers about the saving not working. What attributes should teachers give to the iframe to allow the downloads? sandbox="allow-downloads" does not seem to help. I made a demo here: https://jsfiddle.net/vaqtb4oe/ So far, I am recommending them to use Firefox, but many of them use Chromebooks, where Google has a "monopoly" on browsers. |
@photopea The "allow-downloads" is the right token. However, for your demo, the download would fail because the embedding site jsfiddle.net embeds your demo page in their sandboxed iframe. jsfiddle.net will need to update their sandbox attributes first if they intend to allow download in its subframes. My guess is the schools' website has sandboxed your www.Photopea.com site, so they will need to fix their sandbox first. If you have more questions, please file a bug to https://bugs.chromium.org/p/chromium as this is a Chrome specific issue. |
This was implemented in Chrome at one time, but has been removed. No browser seems to support this currently. There is an open issue with a request to implement this, but that does not seem very active and that does not seem enough to document it on MDN, even as experimental. - https://groups.google.com/a/chromium.org/g/blink-dev/c/JdAQ6HNoZvk?pli=1 - https://chromestatus.com/feature/5706745674465280 - whatwg/html#3236 - whatwg/html#5513
This was implemented in Chrome at one time, but has been removed. No browser seems to support this currently. There is an open issue with a request to implement this, but that does not seem very active and that does not seem enough to document it on MDN, even as experimental. - https://groups.google.com/a/chromium.org/g/blink-dev/c/JdAQ6HNoZvk?pli=1 - https://chromestatus.com/feature/5706745674465280 - whatwg/html#3236 - whatwg/html#5513
Blast from the past: https://lists.w3.org/Archives/Public/public-whatwg-archive/2013Feb/0010.html that came to mind because someone filed another feature request for it against Chrome (duped against crbug #539938).
Would folks in @whatwg/security be on board with this kind of change?
The text was updated successfully, but these errors were encountered: