Bug 197974

Summary: [WebAuthN] Allow authenticators that support both CTAP and U2F to try U2F if CTAP fails in authenticatorGetAssertion
Product: WebKit Reporter: Jiewen Tan <jiewen_tan>
Component: WebKit Misc.Assignee: Jiewen Tan <jiewen_tan>
Status: RESOLVED FIXED    
Severity: Normal CC: alex.gaynor, bfulgham, commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 181943    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Jiewen Tan 2019-05-16 20:21:05 PDT
Allow authenticators that support both CTAP and U2F to try U2F if CTAP fails in authenticatorGetAssertion.
Comment 1 Radar WebKit Bug Importer 2019-05-16 20:24:06 PDT
<rdar://problem/50879746>
Comment 2 Radar WebKit Bug Importer 2019-05-16 20:24:07 PDT Comment hidden (obsolete)
Comment 3 Jiewen Tan 2019-05-16 20:43:07 PDT
Created attachment 370100 [details]
Patch
Comment 4 Jiewen Tan 2019-05-16 22:34:09 PDT
Comment on attachment 370100 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=370100&action=review

> Source/WebKit/ChangeLog:16
> +        to ask a potential U2F credential once a kCtap2ErrInvalidCredential error is returned regarding to the first CTAP request,

I should probably relax all conditions to always downgrade to U2F whenever there is no responses to the first CTAP request.
Comment 5 Jiewen Tan 2019-05-17 00:57:20 PDT
Comment on attachment 370100 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=370100&action=review

> Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:93
> +        auto error = getResponseCode(data);

I should probably relax all conditions to always downgrade to U2F whenever there is no responses to the first CTAP request.
Comment 6 Jiewen Tan 2019-05-17 15:24:47 PDT
Comment on attachment 370100 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=370100&action=review

>> Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:93
>> +        auto error = getResponseCode(data);
> 
> I should probably relax all conditions to always downgrade to U2F whenever there is no responses to the first CTAP request.

The reason behinds this decision is that CTAP2_ERR_NO_CREDENTIALS is recommended in the spec: https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#authenticatorGetAssertion. On contrary, I get CTAP2_ERR_INVALID_CREDENTIAL from some keys. Therefore, we should probably not check any error.

Also, bad user agents might somehow prefer U2F over CTAP, and therefore relaying parties might not be aware of it and supply an appid to indicate a U2F credential should be used instead. Therefore, we should omit that check as well.
Comment 7 Jiewen Tan 2019-05-17 15:36:25 PDT
Created attachment 370163 [details]
Patch
Comment 8 Brent Fulgham 2019-05-17 15:42:25 PDT
Comment on attachment 370163 [details]
Patch

Looks good. r=me
Comment 9 Jiewen Tan 2019-05-17 15:45:42 PDT
Created attachment 370165 [details]
Patch
Comment 10 Jiewen Tan 2019-05-17 15:47:15 PDT
(In reply to Brent Fulgham from comment #8)
> Comment on attachment 370163 [details]
> Patch
> 
> Looks good. r=me

Sorry, Brent. I modified a test and uploaded a new patch which obsolete your r+ flag. Could you r+ it again?
Comment 11 Brent Fulgham 2019-05-17 17:13:18 PDT
Comment on attachment 370165 [details]
Patch

R=me
Comment 12 Jiewen Tan 2019-05-18 17:15:35 PDT
(In reply to Brent Fulgham from comment #11)
> Comment on attachment 370165 [details]
> Patch
> 
> R=me

Thanks Brent for r+ this patch.
Comment 13 WebKit Commit Bot 2019-05-18 17:42:22 PDT
Comment on attachment 370165 [details]
Patch

Clearing flags on attachment: 370165

Committed r245500: <https://trac.webkit.org/changeset/245500>
Comment 14 WebKit Commit Bot 2019-05-18 17:42:24 PDT
All reviewed patches have been landed.  Closing bug.