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

Define what happens when the Document loses focus #316

Closed
jcjones opened this issue Dec 20, 2016 · 11 comments
Closed

Define what happens when the Document loses focus #316

jcjones opened this issue Dec 20, 2016 · 11 comments

Comments

@jcjones
Copy link
Contributor

jcjones commented Dec 20, 2016

(Related to #292)

If an operation such as makeCredential or getAssertion is in progress, and the UA changes focus (e.g., the user switches tabs), what should happen?

I believe it is the case that at least some U2F implementations cancel all operations in-flight and return errors, to avoid potential phishing or denial of service attacks. If that's correct, we should define that behavior for WebAuthn as well.

@equalsJeffH
Copy link
Contributor

You mean U2F client implementations in browsers I presume.

Is this sort of impl considerations written down anywhere (eg mailing list archives, release notes, api documentation, etc) or is only ensconced in code?

@AngeloKai
Copy link
Contributor

I don't see any use cases of any WebAuthn operation when the UA changed the focus, especially considering that the API is not under worker. Let's try to get this in spec soon so that we avoid attacks.

@jyasskin
Copy link
Member

https://w3c.github.io/web-nfc/#handling-window-visibility-and-focus has an attempt to handle focus changes for the NFC API. I think some of the details there have problems, but it points to useful hooks in HTML and Page Visibility.

@selfissued
Copy link
Contributor

If we are going to specify behaviors for this case, we should do so for the Implementer's Draft, since they will affect interop. Or we can decide to leave this unspecified and explicitly document it as such.

@jcjones
Copy link
Contributor Author

jcjones commented May 17, 2017

I have started on this, but I got a bit hung-up on cross-linking into visibility. Basically, I've barely started, but at least I have a branch...

@jcjones
Copy link
Contributor Author

jcjones commented May 18, 2017

The WebNFC spec defines a member variable that is checked at explicit points during the algorithm run. I'm wondering if we could do something simpler, like:

Handling Window Visibility and Focus ## {#visibility-and-focus}

When the [=Window=] object associated with the [=Document=] using the Web Authentication API {{loses focus}}, then:

  1. The user agent SHOULD cancel running operations for each [=authenticator=].

Note: This would have the effect of stopping the display of credential selections, or halting a blinking light.

  1. The user agent MUST ensure that running operations ultimately resolve their {{Promise}}s with a {{DOMException}} whose name is "{{NotAllowedError}}".

@jyasskin
Copy link
Member

@jcjones I think you also need a check that the document has focus before starting authenticator operations, and we should make sure that the "loses focus" event happens in a task rather than in parallel so that there aren't race conditions.

Arguably, something should actually maintain the set of "running operations", so there's an explicit set of things to cancel, but I'm not sure that's essential.

@equalsJeffH
Copy link
Contributor

Are there examples of..

"..we should make sure that the "loses focus" event happens in a task rather than in parallel so that there aren't race conditions"

..in extant whatwg/w3c specs we can examine?

@jyasskin
Copy link
Member

Sorry, by "we" I mostly meant the HTML editors. WebAuthn just needs to use the right hook in HTML, which is now tracked in whatwg/html#2711.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 11, 2017
WebAuthn operations that are in-flight with authenticators must be cancelled
when switching tabs.

There's an Issue [1] opened with the WebAuthn spec for this already, but the
language is _not_ in spec. Still, it's necessary for security, spec or not.

This also matches how Chromium handles U2F operations during a tab switch.

[1] w3c/webauthn#316

MozReview-Commit-ID: 6Qh9oC4pqys

--HG--
extra : rebase_source : ad1665b8140f74b1291f17994285e6146c4ec468
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this issue Aug 14, 2017
WebAuthn operations that are in-flight with authenticators must be cancelled
when switching tabs.

There's an Issue [1] opened with the WebAuthn spec for this already, but the
language is _not_ in spec. Still, it's necessary for security, spec or not.

This also matches how Chromium handles U2F operations during a tab switch.

[1] w3c/webauthn#316

MozReview-Commit-ID: 6Qh9oC4pqys
aethanyc pushed a commit to aethanyc/gecko-dev that referenced this issue Aug 15, 2017
WebAuthn operations that are in-flight with authenticators must be cancelled
when switching tabs.

There's an Issue [1] opened with the WebAuthn spec for this already, but the
language is _not_ in spec. Still, it's necessary for security, spec or not.

This also matches how Chromium handles U2F operations during a tab switch.

[1] w3c/webauthn#316

MozReview-Commit-ID: 6Qh9oC4pqys
@AngeloKai AngeloKai self-assigned this Aug 16, 2017
@nadalin nadalin modified the milestones: WD-07, CR Aug 16, 2017
@AngeloKai
Copy link
Contributor

We decided in WebAuthn WG F2F meeting that this issue can be closed.

@AngeloKai
Copy link
Contributor

The issue is added in pull request #544

gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 1, 2019
WebAuthn operations that are in-flight with authenticators must be cancelled
when switching tabs.

There's an Issue [1] opened with the WebAuthn spec for this already, but the
language is _not_ in spec. Still, it's necessary for security, spec or not.

This also matches how Chromium handles U2F operations during a tab switch.

[1] w3c/webauthn#316

MozReview-Commit-ID: 6Qh9oC4pqys

UltraBlame original commit: f7a53ff2f8cb312eb6a65b127207e04d2bd1c79c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 1, 2019
WebAuthn operations that are in-flight with authenticators must be cancelled
when switching tabs.

There's an Issue [1] opened with the WebAuthn spec for this already, but the
language is _not_ in spec. Still, it's necessary for security, spec or not.

This also matches how Chromium handles U2F operations during a tab switch.

[1] w3c/webauthn#316

MozReview-Commit-ID: 6Qh9oC4pqys

UltraBlame original commit: f7a53ff2f8cb312eb6a65b127207e04d2bd1c79c
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 1, 2019
WebAuthn operations that are in-flight with authenticators must be cancelled
when switching tabs.

There's an Issue [1] opened with the WebAuthn spec for this already, but the
language is _not_ in spec. Still, it's necessary for security, spec or not.

This also matches how Chromium handles U2F operations during a tab switch.

[1] w3c/webauthn#316

MozReview-Commit-ID: 6Qh9oC4pqys

UltraBlame original commit: f7a53ff2f8cb312eb6a65b127207e04d2bd1c79c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment