New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 649918 link

Starred by 4 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocking:
issue 643794



Sign in to add a comment

HTML Anchor element's activation behavior does not take user action into account

Reported by dch...@gmail.com, Sep 24 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36

Steps to reproduce the problem:
1. Go to http://jsfiddle.net/cW7W5/1573/

What is the expected behavior?
It should not download the file as per:
- https://html.spec.whatwg.org/#the-a-element:triggered-by-user-activation (step 2)

Firefox does not download the file.

What went wrong?
Chrome downloads the file even though there is no user interaction or consent.

Did this work before? Yes When the download attribute was not supported.

Chrome version: 53.0.2785.116  Channel: stable
OS Version: OS X 10.12.1
Flash Version: Shockwave Flash 23.0 r0
 
Cc: mkwst@chromium.org
Components: UI>Browser>Downloads
Labels: -Type-Bug-Security -Restrict-View-SecurityTeam Type-Bug
Status: Untriaged (was: Unconfirmed)
Summary: Download attribute on anchor allows download without user interaction (was: download attribute on anchor elements allows download of files without user interaction)
This isn't a security bug, insofar as it does not allow a site to do anything it cannot do in many other ways. Downloads triggered via this mechanism would still be evaluated by Safe Browsing download checks, etc. 

However, this does appear to be a standards-compliance issue, and something which may be easier to fix with changes made in M53 to ignore synthetic events on controls.

@mkwst: PTAL?

Comment 2 by jhwon0...@gmail.com, Sep 25 2016

working on this issue

Comment 3 by asanka@chromium.org, Sep 26 2016

Components: -UI>Browser>Downloads Blink>HTML>A
Labels: -OS-Mac OS-All
Summary: HTML Anchor element's activation behavior does not take user action into account (was: Download attribute on anchor allows download without user interaction)
Yeah. Not a security bug. A web page is allowed to initiate a single download via script or otherwise without a user interaction.

Agree with #1 that this is a compliance issue.

Comment 4 by rbyers@chromium.org, Sep 26 2016

Cc: dtapu...@chromium.org
Labels: Hotlist-Input-Dev
Does this issue also apply to a JS-generated 'click' event?  If so then we should probably be restricting the download behavior to just trusted click events.  We could explicitly test for the presence of a UserGestureIndicator but it would probably be better to rely on explicit isTrusted if it's present.  +dtapuska who's the expert about that.

But +1 that this isn't a security issue.  Eg. the site can also set window.top.location to some URL which sets the right headers to force a download.

Comment 5 by dch...@gmail.com, Sep 26 2016

FYI, ignoring the click if !event.isTrusted is what we do in WebKit.
Cc: jhwon0...@gmail.com
FYI, there is a WIP CL: https://codereview.chromium.org/2371573002/ (jhwon0415 is working on this.)

Comment 8 by rbyers@chromium.org, Sep 28 2016

Owner: jinho.b...@samsung.com
Status: Started (was: Untriaged)
There's some web compat risk here of breaking existing sites, but given that Firefox and WebKit already behave this way I think the risk is minimal and I'm OK treating this as just a bugfix.

But if, after landing, we get reports of this change breaking some real-world sites then we'll probably want to revert and treat this as an "intent to remove" (adding a UseCounter, etc.).  But like I said, I think the risk is low.

Comment 9 by dch...@gmail.com, Sep 28 2016

Although WebKit currently behaves this way (ignores untrusted events), we have not shipped the download attribute support in Safari yet so we don't know about web compatibility risks yet. However, shipping Firefox seems to behave this way already so I would agree the risk is hopefully low.

Comment 10 by dch...@gmail.com, Sep 30 2016

There may be some Web compatibility issue if relying solely on event.isTrusted. See https://bugs.webkit.org/show_bug.cgi?id=156056#c3.

This apparently breaks https://eligrey.com/demos/FileSaver.js/
Blocking: 643794
Labels: UserActivation
Cc: mustaq@chromium.org

Sign in to add a comment