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

Issue 654140 link

Starred by 17 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug

Blocking:
issue 749247
issue 641711
issue 654145
issue 749243



Sign in to add a comment

Page can trap user in full screen with no way to escape

Project Member Reported by esprehn@chromium.org, Oct 8 2016

Issue description

Google Chrome	53.0.2785.144 (Official Build) (64-bit)
Revision	0
Platform	8530.93.0 (Official Build) stable-channel samus
ARC	3301557

This is on my Chromebook Pixel.

What steps will reproduce the problem?
(1) Load http://kalokusatell.xyz/extension/ch7728.php
(2) Click the middle of the fake chrome dialog.
(3) Notice the page go full screen.
(4) Hit ESC to try to get out of it.
(5) Page goes full screen again.

What is the expected output?

Page should never be able to trap you in full screen.

What do you see instead?

Page traps you, there's no escape. Looking at the code the page is doing:

	window.onkeyup = function(e){
		fullScreen();
	};

So every time you try to exit full screen the malware site goes full screen again. This is a pretty terrible experience, there's no obvious escape, you end up rebooting the computer to escape from it, or a typical user might just click the malware link.
 
Blocking: 654145

Comment 2 by drott@chromium.org, Oct 10 2016

Cc: -ojan@chromium.org
Owner: ojan@chromium.org
Status: Assigned (was: Untriaged)
Assigning to Ojan since almost duplicate blocked bug is assigned to Ojan as well.
Cc: foolip@chromium.org

Comment 4 by mea...@chromium.org, Oct 10 2016

Cc: mgiuca@chromium.org
I was just about to file a similar bug. This also works on Linux and Windows, but not MacOS.

Comment 5 by mgiuca@chromium.org, Oct 11 2016

Summary: Page can trap user in full screen with no way to escape (was: Page can trap user in full screen with no way to escape on Chrome OS)
The link mentioned above is 404. I recreated it in a small HTML file (attached).

Hmm, this is indeed a problem (note there is a workaround which is right-click -> exit fullscreen, or simply Ctrl+W). Not sure why it is RBS given that this isn't a regression (it seems). Arguably this regressed in 49 when we turned off the obvious mouse way to exit, but it still would've been a minor problem before that.

The obvious solution is to impose a minimum time (e.g., 2 seconds) after exiting fullscreen before a site is allowed to re-enter fullscreen. This time should still be quite short in case the user legitimately wants to re-enter fullscreen, but long enough to give the user a chance to close the tab via the mouse before the malicious site takes control again. Anyone have a better suggestion?

(We can also do more complex heuristics like increase the minimum time the more times you go into fullscreen, etc.)
fullscreen-trap.html
172 bytes View Download

Comment 6 by ojan@chromium.org, Oct 11 2016

Cc: rsch...@chromium.org dk...@chromium.org rbyers@chromium.org kenjibaheux@chromium.org
A few other options:
1. gate fullscreen on site engagement
2. gate fullscreen having had a user gesture on the page at any point
3. require a user gesture for each fullscreen request

#3 is the most restrictive. Do we have use cases for going into fullscreen that don't involve a user gesture? I can't think of any at the moment.

Comment 7 by mgiuca@chromium.org, Oct 11 2016

> 1. gate fullscreen on site engagement

I don't want to do this. I've seen site engagement suggested as a crutch for getting around a lot of spammy issues. I don't like that direction, since in aggregate it means websites won't be very useful until you interact with them a bunch.

> 2. gate fullscreen having had a user gesture on the page at any point
> 3. require a user gesture for each fullscreen request

Fullscreen already requires a user gesture. The problem is that the hitting Esc to exit *is* a user gesture, so the site is allowed to go fullscreen again.

This gives me some ideas that are probably better than my timing suggestion above:

1. The keyup associated with pressing Esc to exit fullscreen is *not* considered a user gesture (so is not allowed to exit fullscreen or do any other spammy action).
2. We do not deliver a keyup event corresponding to the keypress to exit fullscreen. Since the browser captures the keydown, it should also capture the keyup.

#2 is probably ideal for other reasons anyway (it's weird to deliver a keyup without a corresponding keydown).

Comment 8 by scheib@chromium.org, Oct 11 2016

I agree that if ESC key press is used to exit an exclusive access (fullscreen, pointer, or keyboard lock) then we should not deliver that input in any form (down, press, up) to web content. 

Comment 9 by ojan@chromium.org, Oct 12 2016

Lol. Yes, it should definitely not grant a user gesture.

I agree that delivering keyup without keydown is weird, but I'm not sure the current behavior of not delivering keydown is desired.

It makes more sense to me to deliver a down/press/up sequence and ignore the preventDefault call than it does to not deliver them, but I could see it argued either way. For example, I could imagine youtube wanting to track how often people exit fullscreen via the escape key. If we don't deliver the event at all, they have no way to detect that.

mgiuca, it sounds like you're interested in owning this. Mind if we assign it to you?

Comment 10 by ojan@chromium.org, Oct 12 2016

Cc: dtapu...@chromium.org
+dtapuska, since we're talking user gestures and key events.
Cc: ojan@chromium.org
Labels: -M-55 -ReleaseBlock-Stable M-56
Owner: mgiuca@chromium.org
> It makes more sense to me to deliver a down/press/up sequence and ignore the preventDefault call

I don't see how that will help fix this bug: the issue isn't that the esc is being preventDefault'd. It's that fullscreen mode is being re-requested on keyup, and we allow that because the keyup is a user gesture.

It sounds like you're (ojan) leaning towards #7 suggestion 1 (deliver the events but don't consider it a user gesture for the purpose of deciding what capabilities are allowed).

> I could imagine youtube wanting to track how often people exit fullscreen via the escape key

I don't really see why we should give the site access to those signals. They can already detect when fullscreen mode is exited; do they really need to see when the escape key was used versus the mouse?

It might be worth figuring out whether other browsers deliver this signal.

> mgiuca, it sounds like you're interested in owning this. Mind if we assign it to you?

Yeah OK, I'm not sure I have time to work on this immediately but I should be able to get to it in the M56 timeframe.

Adjusting the labels given that this has been an issue since at least March, it doesn't need to be RBS 55.

Comment 12 by ojan@chromium.org, Oct 12 2016

I think doing this in time for M56 is ideal. Thanks!

I didn't mean the preventDefault thing as a solution to this problem, but rather as a way of firing the events without allowing the page to prevent esc from exiting fullscreen.

For this issue, I was thinking that not granting a user gesture was the right solution, but I think that depends on whether we fire the keydown event. If we decide not firing keydown is the right thing to do, then I think not firing keyup is also correct (#7 suggestion 2).

But, if we were starting with a clean slate, I would fire all the regular key events, ignore or disallow preventDefault, and not grant a user gesture.

I agree that the next step is to see what other browsers do with the key events.

Can we deliver the key events to the app but mark them as non-cancelable?
And for non-cancelable key events don't generate a user gesture?


I'm sure that's possible (but I don't exactly know how), and would fix the issue. First we should decide if we want to do that, or just not deliver the keyup at all.
Cc: ackermanb@chromium.org
Blocking: 641711
 Issue 100441  is a very old issue mentioned in Browser::PreHandleKeyboardEvent. The comment says "This may consume the event (e.g., Esc exits fullscreen mode)."

It looks like the keydown and keypress events are in fact consumed and never delivered, but the keyup event is. In the interest of moving forward, I suggest also consuming the keyup event.

Comment 18 by ojan@chromium.org, Nov 7 2016

Looks like Firefox consumes the events as well. Let's go with that for now. m56 branches in 10 days. mguica, any can you can prioritize getting this fixed before then?
Yes.
 Issue 641711  has been merged into this issue.
Owner: foolip@chromium.org
Status: Started (was: Assigned)
foolip@ has stepped up and mailed out a patch that fixes this:
https://codereview.chromium.org/2482853002/

So assigning to him to finish that up. Thanks Philip!
Status: Fixed (was: Started)
Cc: yzshen@chromium.org scheib@chromium.org
 Issue 142524  has been merged into this issue.
Cc: jmukthavaram@chromium.org
 Issue 672515  has been merged into this issue.

Comment 26 by e...@chromium.org, Jan 4 2017

 Issue 678280  has been merged into this issue.
 Issue 680630  has been merged into this issue.
 Issue 682233  has been merged into this issue.
Blocking: 749247
Blocking: 749243
Cc: jsc...@chromium.org
 Issue 749243  has been merged into this issue.

Sign in to add a comment