Bug 193150 - [WebAuthN] Import U2F command/response converters from Chromium
Summary: [WebAuthN] Import U2F command/response converters from Chromium
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jiewen Tan
URL:
Keywords: InRadar
Depends on:
Blocks: 181943
  Show dependency treegraph
 
Reported: 2019-01-04 12:05 PST by Jiewen Tan
Modified: 2019-01-07 08:33 PST (History)
6 users (show)

See Also:


Attachments
Patch (120.51 KB, patch)
2019-01-04 13:27 PST, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch (120.51 KB, patch)
2019-01-04 16:55 PST, Jiewen Tan
bfulgham: review+
Details | Formatted Diff | Diff
Patch for landing (120.50 KB, patch)
2019-01-06 17:31 PST, Jiewen Tan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiewen Tan 2019-01-04 12:05:03 PST
Import U2F command/response converters from Chromium.
Comment 1 Radar WebKit Bug Importer 2019-01-04 12:06:00 PST
<rdar://problem/47054028>
Comment 2 Jiewen Tan 2019-01-04 13:27:35 PST
Created attachment 358358 [details]
Patch
Comment 3 Build Bot 2019-01-04 13:30:54 PST Comment hidden (obsolete)
Comment 4 Jiewen Tan 2019-01-04 16:55:04 PST
Created attachment 358399 [details]
Patch
Comment 5 Build Bot 2019-01-04 17:00:53 PST
Attachment 358399 [details] did not pass style-queue:


ERROR: Source/WebCore/Modules/webauthn/WebAuthenticationConstants.h:41:  P_256 is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 1 in 25 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Brent Fulgham 2019-01-06 16:43:36 PST
Comment on attachment 358399 [details]
Patch

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

R=me

> Source/WebCore/ChangeLog:20
> +        Besides importing stuffs from Chroimum, it also gathers a bunch of constants and helper functions into WebAuthenticationConstants.h

Besides importing stuff from Chromium ...

> Source/WebCore/Modules/webauthn/fido/U2fCommandConstructor.cpp:90
> +        if (parameters.alg == COSE::ES256)

This really seems like something a std::find would work for.  But it’s fine as-is.

> Source/WebCore/Modules/webauthn/fido/U2fCommandConstructor.cpp:114
> +    return constructU2fSignCommand(produceRpIdHash(request.rp.id), clientDataHash, keyHandle.idVector, true /* checkOnly */);

The need for this comment indicates this should be an enumeration! But since this is imported code, land as-is and then post a patch to clean up the interface.

> Source/WebCore/Modules/webauthn/fido/U2fResponseConverter.cpp:71
> +    x.append(u2fData.data() + pos, ES256FieldElementLength);

Can the vector be constructed directly with this data? Or at least sized properly, rather than having a separate allocation event, then a resize as we append.

This is true for all such cases.

> Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp:34
> +#include "GPURenderPipeline.h"

Is this needed as part of this patch? Was it causing a build error for you?
Comment 7 Jiewen Tan 2019-01-06 17:23:24 PST
Comment on attachment 358399 [details]
Patch

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

Thanks Brent for r+ this patch.

>> Source/WebCore/ChangeLog:20
>> +        Besides importing stuffs from Chroimum, it also gathers a bunch of constants and helper functions into WebAuthenticationConstants.h
> 
> Besides importing stuff from Chromium ...

Fixed.

>> Source/WebCore/Modules/webauthn/fido/U2fCommandConstructor.cpp:90
>> +        if (parameters.alg == COSE::ES256)
> 
> This really seems like something a std::find would work for.  But it’s fine as-is.

You are right! Fixed.

>> Source/WebCore/Modules/webauthn/fido/U2fCommandConstructor.cpp:114
>> +    return constructU2fSignCommand(produceRpIdHash(request.rp.id), clientDataHash, keyHandle.idVector, true /* checkOnly */);
> 
> The need for this comment indicates this should be an enumeration! But since this is imported code, land as-is and then post a patch to clean up the interface.

Sure.

>> Source/WebCore/Modules/webauthn/fido/U2fResponseConverter.cpp:71
>> +    x.append(u2fData.data() + pos, ES256FieldElementLength);
> 
> Can the vector be constructed directly with this data? Or at least sized properly, rather than having a separate allocation event, then a resize as we append.
> 
> This is true for all such cases.

It looks like that the default cntr of Vector does nothing. Therefore we will have only one allocation event when we append.

>> Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp:34
>> +#include "GPURenderPipeline.h"
> 
> Is this needed as part of this patch? Was it causing a build error for you?

Some kind of unified source build magic...
Comment 8 Jiewen Tan 2019-01-06 17:31:04 PST
Created attachment 358470 [details]
Patch for landing
Comment 9 WebKit Commit Bot 2019-01-06 18:08:29 PST
Comment on attachment 358470 [details]
Patch for landing

Clearing flags on attachment: 358470

Committed r239665: <https://trac.webkit.org/changeset/239665>