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

Add "conditional mediation" #155

Merged
merged 14 commits into from
Dec 6, 2021
Merged

Conversation

equalsJeffH
Copy link
Collaborator

@equalsJeffH equalsJeffH commented Feb 18, 2021

This PR adds the Credential Management-layer underpinnings necessary for credential types to effect a "Conditional UI" with WebAuthn being the driving use case, as explained in Explainer: WebAuthn Conditional/Hinted UI.

The related WebAuthn issues and PRs are:


Preview | Diff

@mikewest
Copy link
Member

Thanks for including a link to the explainer, that's really helpful. The approach seems reasonable, but it seems like something we should run through the TAG before we'd ship it in Chromium. Would you mind filing a review request?

Are other vendors on board with the approach/extra enum value?

Copy link
Member

@nsatragno nsatragno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few thoughts that came up after more thinking.

(also, did you mean to update the html? seems like a bunch of unrelated changes but if the file is autogenerated maybe it doesn't matter?)

index.src.html Outdated Show resolved Hide resolved
index.src.html Outdated Show resolved Hide resolved
index.src.html Outdated Show resolved Hide resolved
@equalsJeffH equalsJeffH marked this pull request as draft March 11, 2021 23:53
index.src.html Outdated Show resolved Hide resolved
@equalsJeffH
Copy link
Collaborator Author

(also, did you mean to update the html? seems like a bunch of unrelated changes but if the file is autogenerated maybe it doesn't matter?)

Yeah, I think editors are expected to re-gen the html file at the time of pushing changes to the .bs source file up to the repo here, and I probably didn't do it properly.

nsatragno pushed a commit to nsatragno/webauthn that referenced this pull request Oct 15, 2021
@w3c w3c deleted a comment Oct 18, 2021
@w3c w3c deleted a comment Oct 18, 2021
equalsJeffH and others added 6 commits October 18, 2021 14:27
* Fix some links
* Discover availability by calling a method on each Credential interface
  object to discriminate between credential types
* Instruct the browser to avoid revealing credential availability when
  using conditional UI on error.
I think it was brought by an earlier merge commit. Should be fine if we
squash and rebase this into main later.
@nsatragno nsatragno force-pushed the jeffh-add-conditional-mediation-approach branch from 535006d to 9dc6bc8 Compare October 25, 2021 19:37
@nsatragno
Copy link
Member

@equalsJeffH please take a look, I've addressed the comments (and merged here for ease of maintenance)

Copy link
Collaborator Author

@equalsJeffH equalsJeffH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nsatragno, this is really close. On detailed review I wonder about whether declaring isConditionalMediationAvailable() as static is what we want, and then a few modest editorial suggestions/fixes.

index.bs Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@nsatragno nsatragno self-assigned this Nov 3, 2021
@nsatragno nsatragno marked this pull request as ready for review November 3, 2021 19:43
@equalsJeffH equalsJeffH requested a review from dveditz November 3, 2021 20:40
@equalsJeffH equalsJeffH requested a review from jyasskin November 3, 2021 20:40
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated
Comment on lines 664 to 667
If no credentials are discovered, the user agent MAY prompt the user to take action in a way
that depends on the type of credential (e.g. to insert a device containing credentials).
Either way, the `get()` method MUST NOT return immediately with `null` to avoid revealing
the lack of applicable credentials to the website.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm nervous about having normative requirements in this section. They need to be reflected in the algorithm below regardless, and having them here too introduces the possibility for them to get out of sync.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

I think it's fine since the whole not returning empty-handed is critical to Conditional UI anyway. Either way I changed "return immediately" by "resolve immediately".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point about the MUST NOT. Where does the "MAY prompt" happen? It seems like it'd fit just before the call to "ask the user to choose a Credential, but that doesn't call back to the particular credential types in the list.

This might be a pre-existing difference between the spec and implementations, in which case feel free to defer it to a separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the "MAY prompt" happen?

I'm not sure I understand this.

It seems like it'd fit just before the call to "ask the user to choose a Credential,

We could definitely add a note there for credential types other than PublicKeyCredential.

that doesn't call back to the particular credential types in the list.

WebAuthn loosely specifies its own credential chooser on [[PublicKeyCredential/DiscoverFromExternalSource]], and there's a bunch of conditional mediation logic I'm adding there. The implementation matches the spec in a non obvious way: only one credential type is supported at a time, so CredMan's "ask the user to choose a Credential" does not actually prompt the user ("PublicKeyCredential" is always selected as the default) and the webauthn "picker" is shown instead (and the user being prompted to interact with their authenticator satisfies the mediation requests).

I think the way this PR deals with choosing credentials (and the spec before this PR) is correct, or at least good enough. Hopefully that makes sense?

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated
Comment on lines 664 to 667
If no credentials are discovered, the user agent MAY prompt the user to take action in a way
that depends on the type of credential (e.g. to insert a device containing credentials).
Either way, the `get()` method MUST NOT return immediately with `null` to avoid revealing
the lack of applicable credentials to the website.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point about the MUST NOT. Where does the "MAY prompt" happen? It seems like it'd fit just before the call to "ask the user to choose a Credential, but that doesn't call back to the particular credential types in the list.

This might be a pre-existing difference between the spec and implementations, in which case feel free to defer it to a separate PR.

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
Copy link
Member

@jyasskin jyasskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good once you've fixed the build. (This spec ran into whatwg/dom#1027 which renamed the 'aborted flag'.)

@nsatragno
Copy link
Member

nsatragno commented Nov 9, 2021

Thanks! I changed it to reference the aborted attribute to keep the same language. Probably nbd either way.

nvm I filed pr #176 for this

@nsatragno nsatragno force-pushed the jeffh-add-conditional-mediation-approach branch from 8fa9b22 to 5d07770 Compare November 10, 2021 16:03
@equalsJeffH
Copy link
Collaborator Author

This needs a merge-from-main in order to pick up the changes from PR #176 (now merged), which will fix the failing build (the w3c spec-prod machinery stipulates a "die on warning" and so will not build correctly unless all the references and such are properly resolving)

Copy link
Collaborator Author

@equalsJeffH equalsJeffH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, ready for reviews :)
Thanks @nsatragno !

@nsatragno nsatragno merged commit b273b4a into main Dec 6, 2021
@nsatragno nsatragno deleted the jeffh-add-conditional-mediation-approach branch December 6, 2021 21:40
github-actions bot added a commit that referenced this pull request Dec 6, 2021
SHA: b273b4a
Reason: push, by @nsatragno

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
nsatragno pushed a commit to nsatragno/webauthn that referenced this pull request Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants