WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
225519
[Cocoa] _WKAuthenticatorAssertionResponse should specify the attachment type used
https://bugs.webkit.org/show_bug.cgi?id=225519
Summary
[Cocoa] _WKAuthenticatorAssertionResponse should specify the attachment type ...
Brent Fulgham
Reported
2021-05-07 09:58:04 PDT
Include context about whether the _WKAuthenticatorAssertionResponse came from the platform authenticator or a security key.
Attachments
Patch
(44.12 KB, patch)
2021-05-07 10:15 PDT
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
Updated patch to replace the current one
(66.26 KB, patch)
2021-05-26 17:00 PDT
,
Garrett Davidson
no flags
Details
Formatted Diff
Diff
Garrett's Patch (Rebaselined)
(67.83 KB, patch)
2021-05-27 16:36 PDT
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
Patch (Rebase Attempt #2)
(67.88 KB, patch)
2021-05-28 11:29 PDT
,
Brent Fulgham
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Rebased patch with fixed tests
(79.27 KB, patch)
2021-05-28 14:18 PDT
,
Garrett Davidson
no flags
Details
Formatted Diff
Diff
Garrett's Patch with forward declaration.
(85.76 KB, patch)
2021-06-01 14:50 PDT
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
Garrett's Patch with fwd declaration (and the cast)
(85.78 KB, patch)
2021-06-01 14:57 PDT
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Brent Fulgham
Comment 1
2021-05-07 10:00:11 PDT
<
rdar://problem/76554090
>
Brent Fulgham
Comment 2
2021-05-07 10:15:45 PDT
Created
attachment 428007
[details]
Patch
Jiewen Tan
Comment 3
2021-05-07 15:42:08 PDT
Comment on
attachment 428007
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=428007&action=review
> Source/WebCore/Modules/webauthn/AuthenticatorAssertionResponse.h:40 > + static Ref<AuthenticatorAssertionResponse> create(Ref<ArrayBuffer>&& rawId, Ref<ArrayBuffer>&& authenticatorData, Ref<ArrayBuffer>&& signature, RefPtr<ArrayBuffer>&& userHandle, Optional<AuthenticationExtensionsClientOutputs>&&, AuthenticatorResponse::Attachment);
This is only used in the Web API. No need to add attachment to it.
> Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.h:36 > + static Ref<AuthenticatorAttestationResponse> create(Ref<ArrayBuffer>&& rawId, Ref<ArrayBuffer>&& attestationObject, AuthenticatorResponse::Attachment);
Ditto.
> Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp:194 > + if (auto response = AuthenticatorResponse::tryCreate(WTFMove(data), AuthenticatorResponse::Attachment::CrossPlatform)) {
You cannot assume this.
> Source/WebCore/Modules/webauthn/AuthenticatorCoordinator.cpp:265 > + if (auto response = AuthenticatorResponse::tryCreate(WTFMove(data), AuthenticatorResponse::Attachment::CrossPlatform)) {
Ditto.
> Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp:37 > +RefPtr<AuthenticatorResponse> AuthenticatorResponse::tryCreate(AuthenticatorResponseData&& data, Attachment attachment)
It's only used in the Web API. No need for this.
> Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp:88 > +AuthenticatorResponse::Attachment AuthenticatorResponse::attachment() const
You can do it in the header.
> Source/WebCore/Modules/webauthn/AuthenticatorResponse.h:46 > + enum class Attachment {
Instead of making a new enum, use WebCore::AuthenticatorAttachment.
> Source/WebCore/Modules/webauthn/AuthenticatorResponse.h:71 > + Attachment m_attachment;
This is only for the SPI not the Web API. Let's make it Optional such that it's not necessary to serialize it back to the web process.
> Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp:139 > + return AuthenticatorAttestationResponse::create(credentialId, *attestationObject, AuthenticatorResponse::Attachment::CrossPlatform);
Add a new parameter to this function and do it in the Authenticator layer. It's not guaranteed that only external authenticators will use this function.
> Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp:176 > + response = AuthenticatorAssertionResponse::create(credentialId, authData, signature, userHandle, AuthenticatorResponse::Attachment::CrossPlatform);
Ditto.
> Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.cpp:192 > + response = AuthenticatorAssertionResponse::create(credentialId, authData, signature, { }, AuthenticatorResponse::Attachment::CrossPlatform);
Ditto.
> Source/WebCore/Modules/webauthn/fido/U2fResponseConverter.cpp:170 > + return AuthenticatorAttestationResponse::create(credentialId, attestationObject, AuthenticatorResponse::Attachment::CrossPlatform);
Ditto.
> Source/WebCore/Modules/webauthn/fido/U2fResponseConverter.cpp:190 > + return AuthenticatorAssertionResponse::create(keyHandle, authData, signature, { }, AuthenticatorResponse::Attachment::CrossPlatform);
Ditto.
Garrett Davidson
Comment 4
2021-05-26 17:00:52 PDT
Created
attachment 429816
[details]
Updated patch to replace the current one
Brent Fulgham
Comment 5
2021-05-27 16:36:31 PDT
Created
attachment 429952
[details]
Garrett's Patch (Rebaselined)
Brent Fulgham
Comment 6
2021-05-27 16:41:23 PDT
Comment on
attachment 429952
[details]
Garrett's Patch (Rebaselined) View in context:
https://bugs.webkit.org/attachment.cgi?id=429952&action=review
> Source/WebCore/Modules/webauthn/AuthenticatorAssertionResponse.h:40 > + static Ref<AuthenticatorAssertionResponse> create(Ref<ArrayBuffer>&& rawId, Ref<ArrayBuffer>&& authenticatorData, Ref<ArrayBuffer>&& signature, RefPtr<ArrayBuffer>&& userHandle, Optional<AuthenticationExtensionsClientOutputs>&&, AuthenticatorAttachment);
Jiewen pointed out this is only used by the WebAPI -- is there any reason to keep the unused AuthenticatorAttachment argument?
> Source/WebCore/Modules/webauthn/AuthenticatorAttestationResponse.h:36 > + static Ref<AuthenticatorAttestationResponse> create(Ref<ArrayBuffer>&& rawId, Ref<ArrayBuffer>&& attestationObject, AuthenticatorAttachment);
Ditto.
> Source/WebCore/Modules/webauthn/AuthenticatorResponse.cpp:90 > + return m_attachment;
Jiewen suggested you move this to the header: Any reason not to?
> Source/WebCore/Modules/webauthn/AuthenticatorResponse.h:67 > + AuthenticatorAttachment m_attachment;
You didn't address Jiewen's comment that this isn't needed in the Web layer, so serializing it back/forth to the WebContent process seems wasteful. Can we make it Optional<>?
Garrett Davidson
Comment 7
2021-05-27 16:58:19 PDT
(In reply to Brent Fulgham from
comment #6
)
> You didn't address Jiewen's comment that this isn't needed in the Web layer, > so serializing it back/forth to the WebContent process seems wasteful. Can > we make it Optional<>?
I'm new in this codebase, so this is probably just my lack of understanding, but what's being "wasted" here? Isn't it the same amount of space to encode an empty Optional<> as it is to encode an int? If we go to Optional<> route, we effectively end up with a partially initialized object which has more complex usage because you have to add code to handle not having a value, as opposed to guaranteeing it's always there.
> Jiewen suggested you move this to the header: Any reason not to?
I tried moving it to the header and ended up getting errors about an exported symbol being defined in multiple compilation units. My assumption was that you can't mix `WEBCORE_EXPORT` with a method defined in a header, but if I missed something I'm happy to move it :)
Brent Fulgham
Comment 8
2021-05-28 11:29:04 PDT
Created
attachment 430030
[details]
Patch (Rebase Attempt #2)
Brent Fulgham
Comment 9
2021-05-28 11:32:19 PDT
(In reply to Garrett Davidson from
comment #7
)
> (In reply to Brent Fulgham from
comment #6
) > > > You didn't address Jiewen's comment that this isn't needed in the Web layer, > > so serializing it back/forth to the WebContent process seems wasteful. Can > > we make it Optional<>? > > I'm new in this codebase, so this is probably just my lack of understanding, > but what's being "wasted" here? Isn't it the same amount of space to encode > an empty Optional<> as it is to encode an int? If we go to Optional<> route, > we effectively end up with a partially initialized object which has more > complex usage because you have to add code to handle not having a value, as > opposed to guaranteeing it's always there.
Fair enough. We encode a nullptr for this case, which would be the same size in IPC as an integer value.
> > Jiewen suggested you move this to the header: Any reason not to? > > I tried moving it to the header and ended up getting errors about an > exported symbol being defined in multiple compilation units. My assumption > was that you can't mix `WEBCORE_EXPORT` with a method defined in a header, > but if I missed something I'm happy to move it :)
Ah, yes. That's true. Inline and WEBCORE_EXPORT don't mix.
Brent Fulgham
Comment 10
2021-05-28 11:40:22 PDT
Comment on
attachment 430030
[details]
Patch (Rebase Attempt #2) View in context:
https://bugs.webkit.org/attachment.cgi?id=430030&action=review
> Source/WebCore/Modules/webauthn/AuthenticatorCoordinatorClient.h:30 > +#include "AuthenticatorAttachment.h"
It would be better if we could forward-declare this, and include in the implementation file.
Garrett Davidson
Comment 11
2021-05-28 13:11:05 PDT
(In reply to Brent Fulgham from
comment #10
)
> Comment on
attachment 430030
[details]
> Patch (Rebase Attempt #2) > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=430030&action=review
> > > Source/WebCore/Modules/webauthn/AuthenticatorCoordinatorClient.h:30 > > +#include "AuthenticatorAttachment.h" > > It would be better if we could forward-declare this, and include in the > implementation file.
The only thing in AuthenticatorAttachment.h is the AuthenticatorAttachment enum. Can that be forward declared?
Garrett Davidson
Comment 12
2021-05-28 14:18:32 PDT
Created
attachment 430050
[details]
Rebased patch with fixed tests
Alex Christensen
Comment 13
2021-06-01 11:46:57 PDT
Comment on
attachment 430050
[details]
Rebased patch with fixed tests View in context:
https://bugs.webkit.org/attachment.cgi?id=430050&action=review
> Source/WebCore/Modules/webauthn/AuthenticatorResponse.h:67 > + AuthenticatorAttachment m_attachment;
Since we're storing this, this would probably be a good time to reduce the size. Replace "enum class AuthenticatorAttachment" with "enum class AuthenticatorAttachment : bool", and you can also remove the EnumTraits in AuthenticatorAttachment.h
> Source/WebKit/UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:75 > + handler({ }, (AuthenticatorAttachment)0, exception);
This is actually AuthenticatorAttachment::Platform. Is that what you want? Maybe you want Optional<AuthenticatorAttachment>
> Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp:87 > + handler({ }, (AuthenticatorAttachment)0, exception);
ditto
> Tools/ChangeLog:1 > +2021-05-28 Garrett Davidson <
davidson.garrettm@gmail.com
>
Is this the email address you want to use?
> Tools/ChangeLog:11 > + Update the CTAP tests to specify the new attachment parameter. All of these tests > + assume a cross platform authenticator.
Is it possible to add a test that uses AuthenticatorAttachment::Platform?
Darin Adler
Comment 14
2021-06-01 14:17:16 PDT
Comment on
attachment 430050
[details]
Rebased patch with fixed tests View in context:
https://bugs.webkit.org/attachment.cgi?id=430050&action=review
>> Source/WebCore/Modules/webauthn/AuthenticatorResponse.h:67 >> + AuthenticatorAttachment m_attachment; > > Since we're storing this, this would probably be a good time to reduce the size. Replace "enum class AuthenticatorAttachment" with "enum class AuthenticatorAttachment : bool", and you can also remove the EnumTraits in AuthenticatorAttachment.h
Please note that ": bool" does not depend on "enum" vs. "enum class". Could do that whether or not we change this to an enum class.
Brent Fulgham
Comment 15
2021-06-01 14:50:24 PDT
Created
attachment 430291
[details]
Garrett's Patch with forward declaration.
Brent Fulgham
Comment 16
2021-06-01 14:54:11 PDT
Comment on
attachment 430291
[details]
Garrett's Patch with forward declaration. View in context:
https://bugs.webkit.org/attachment.cgi?id=430291&action=review
Thanks for fixing the API tests. r=me, but waiting for EWS to complete.
> Source/WebKit/WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp:87 > + handler({ }, (AuthenticatorAttachment)0, exception);
This should be a C++ style cast. Or should we just be hard-coding it as AuthenticatorAttachment::Platform?
Brent Fulgham
Comment 17
2021-06-01 14:57:30 PDT
Created
attachment 430295
[details]
Garrett's Patch with fwd declaration (and the cast)
EWS
Comment 18
2021-06-02 09:42:36 PDT
Committed
r278358
(
238390@main
): <
https://commits.webkit.org/238390@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 430295
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug