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

Keyboard Lock #196

Open
adamopenweb opened this issue Jul 30, 2019 · 17 comments · May be fixed by #353
Open

Keyboard Lock #196

adamopenweb opened this issue Jul 30, 2019 · 17 comments · May be fixed by #353
Labels
venue: W3C CG Specifications in W3C Community Groups (e.g., WICG, Privacy CG)

Comments

@adamopenweb
Copy link

adamopenweb commented Jul 30, 2019

Request for Mozilla Position on an Emerging Web Specification

Other information

A popular game streaming service has indicated there is value in this feature for their users.

@bzbarsky
Copy link
Contributor

@martinthomson @smaug----

@adamroach
Copy link
Contributor

Not necessarily an issue that blocks support; but in glancing over the description of the intended feature, it requires that the site in question be full-screen as a predicate for requesting access to the system keys. Presumably this is done as part of the security story (although I don't see any treatment of the assumed threats in the explainer). Without having given a lot of time thinking about the attacks that this aspect of the solution is intended to address: if this is part of the security story, then the proposal needs more text to talk about interactions with other open applications in multi-monitor configurations (where the browser is full-screen in only one of several monitors).

@martinthomson
Copy link
Member

This seems like a broadly reasonable feature to me. The lack of spec is not a big deal, but there are a few things that would need to be worked through, like the permission model.

I would caution that holding ESC is probably insufficient a signal. Repeatedly striking the key should probably have the same effect. The notice that is shown in the examples is too similar to the notice we show for regular fullscreen access, so the special status might be hard to discern. It seems like we should try to be generous in our interpretation of any signal like that.

If @adamroach's question has a reasonable answer, then I would suggest that this is instead an addition to the fullscreen API rather than a separate API.

Passing a set of keys to capture seems like it overcomplicates the API. A simple boolean should suffice. Then we don't have odd situations where Alt-Tab is captured in some cases and not others. Consistency in user experience suggests that this would benefit from simplification.

No mention in the explainer about the Windows Key. Where there is a "system" key like that, we should probably also exit fullscreen and end the keylock. I realize that this could make game developers unhappy, as disabling that key is now a regular feature in games, but it might be used to spoof a system take-over by drive-by sites, at the low, low cost of a mouse click or keypress.

@adamroach adamroach added the venue: W3C CG Specifications in W3C Community Groups (e.g., WICG, Privacy CG) label Nov 16, 2019
@dbaron
Copy link
Contributor

dbaron commented May 22, 2020

It seems like there's a v2 proposal that we should probably take a look at (if that wasn't what we were looking at before).

@hsinyi
Copy link

hsinyi commented May 25, 2020

@martinthomson
Copy link
Member

I just had a look at the v2 version of this. It looks the same as the old one in all ways that matter.

I still don't understand why this needs to be able to pick and choose keys. That way lies inconsistency and exploitation. Let's say that a site grabs a subset of keys. Now I become acclimatized to using a key combo that isn't captured (e.g., ctrl-w to close the tab). The site can subsequently change its mind and then hijack that interaction.

It is also harder to communicate about what has happened if there are multiple options. The API still contemplates capturing system keys with no special consideration given.

Finally, though this is the domain of individual browser UX, communicating about what is happening needs more consideration in the design. In Firefox, we have an overlay that appears after the transition to fullscreen for this purpose. That explains what happens and what you can do as a user to correct it, which are critical accountability measures. For this API, you might imagine showing an additional icon on that notification when keys are locked. In this case, we have a separate API, so the fullscreen transition might happen without locked keys, and we lose the ability to control that transition. Showing a notification overlay when locking happens is maybe possible, but that is less good as you now have two transitions and notifications to concern yourself with. Having ambiguity in what keys are captured makes it worse.

As the new proposal doesn't really address these UX concerns, I don't think that this is ready to evaluate.

@smaug----
Copy link
Collaborator

smaug---- commented May 26, 2020

The ability to pick and choose keys causes also a possible web compat issue, when some UA A hasn't reserved some key but some other UA B has and web dev tests only on A. Easy to forget to lock all the keys needed.

It seems to be also unclear how key lock should work on editing areas, like <input>. Chrome impl doesn't seem to prevent relevant default actions. Should it?

dbaron added a commit to dbaron/standards-positions that referenced this issue Jun 1, 2020
This adds it as a harmful position, although it could also be written as
a defer position based on the feedback in mozilla#196.
dbaron added a commit to dbaron/standards-positions that referenced this issue Jun 1, 2020
This adds it as a harmful position, although it could also be written as
a defer position based on the feedback in mozilla#196.

Closes mozilla#196.
@dbaron dbaron linked a pull request Jun 1, 2020 that will close this issue
@martinthomson
Copy link
Member

Here's a sketch of an alternative that I believe addresses the concerns raised here. It also has the advantage of being a modest-sized pull request on the Fullscreen API rather than a full-sized specification.

I don't have a good sense about how to manage <input>, but it seems like it shouldn't be intractable. One model to use is that there is a default handler for key events that a site can receive and maybe intercept. With that model, adding the ability to both receive and block events for keys that would otherwise be browser-managed is simple. That would not necessarily break <input> if consistently applied. Indeed, <input> would still work up until keys that were necessary for proper function being intercepted.

The current structure of Section 3.2 of the proposal is a little bit vague regarding how events are handled. It seems to imply that the API causes the event to be delivered AND the default action prevented. This is not consistent with other key events.

@marcoscaceres
Copy link
Contributor

marcoscaceres commented Jun 17, 2020

I think we should publish our position (#353) and file a bug over on the Keyboard Lock repo with the alternative. Then we can pick up the conversation there.

@paralin
Copy link

paralin commented Nov 3, 2023

Keyboard Lock API is included in Chrome now: https://caniuse.com/mdn-api_keyboard_lock

Will it appear in Firefox as well?

@jesup
Copy link
Member

jesup commented Nov 4, 2023

We indicated the proposed API was harmful, though we think the usecase is reasonable. My cursory scan of the current API it appears that the issues we raised have not been addressed. In fact, checking the issue tracker, it looks like no real work has been done (and hardly any comments) to any of the issues filed against this over 3 years ago. It has the appearance of a post-facto spec thrown over the wall after an implementation was done, and then dropped.

@marcoscaceres
Copy link
Contributor

marcoscaceres commented Nov 29, 2023

Just two little things... just to avoid confusion, would you mind removing my username from the OP? (though always a Mozillian at heart ❤️)

We are working on a WebKit Position for this: WebKit/standards-positions#182

I think we reached the same conclusions reached here. I think we all acknowledge the use case and it would be interesting to expand on the aforementioned proposal.

@martinthomson, or other folks, could you bring that to the WICG and maybe we can work on it together with the webkit community? It seems to address a lot of the concerns and it's in line with similar proposals, for example: whatwg/fullscreen#207

@martinthomson
Copy link
Member

I can't commit to the time necessary to drive that proposal, but I will ask around to see if anyone else at Mozilla is interested.

@marcoscaceres
Copy link
Contributor

That's ok. We can also try to find someone to drive it on the WebKit side. The main thing would be having it as a contribution on the WICG side for IPR reasons.

@martinthomson
Copy link
Member

I'm happy to formally make the contribution to any W3C group if that would help your IPR concerns. It seems like fullscreen was moved to WHATWG. Would their IPR policy be sufficient? It seems like working over there would be the ideal outcome for something that is relatively small like this.

@martinthomson
Copy link
Member

See whatwg/fullscreen#231

@zcorpan
Copy link
Member

zcorpan commented Aug 9, 2024

See https://textslashplain.com/2023/09/12/attack-techniques-fullscreen-abuse/ for an attack vector with fullscreen and keyboard lock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
venue: W3C CG Specifications in W3C Community Groups (e.g., WICG, Privacy CG)
Projects
Status: Unscreened
Development

Successfully merging a pull request may close this issue.