Skip to content

LG-12571 Specify "hints" for WebAuthn security key enrollment#10382

Merged
kevinsmaster5 merged 7 commits intomainfrom
kmas-lg-12571-specify-webauthn-hints
Apr 10, 2024
Merged

LG-12571 Specify "hints" for WebAuthn security key enrollment#10382
kevinsmaster5 merged 7 commits intomainfrom
kmas-lg-12571-specify-webauthn-hints

Conversation

@kevinsmaster5
Copy link
Contributor

🎫 Ticket

LG-12571

🛠 Summary of changes

When enrolling a non-platform webauthn device it passes the value 'security-key' with the authenticatorSelection object.
Platform devices will have 'client-device' added.
https://www.w3.org/TR/webauthn-3/#dom-publickeycredentialhints-client-device

📜 Testing Plan

Test for enroll-webauthn-device should pass.
Setup should work as before without any issues.

.filter(Boolean),
),
authenticatorAttachment: platformAuthenticator ? 'platform' : 'cross-platform',
publicKeyCredentialHints: platformAuthenticator ? 'client-device' : 'security-key',
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should support "hybrid" for platform authenticator enrollments, like using a smartphone QR code to complete MFA setup initiated on a computer. I'd think we should either leave the hints unspecified for platform authenticators, or provide an array including both client-device and hybrid (in order of preference).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added 'hybrid' into the acceptable options.

}

interface AuthenticatorSelectionCriteriaWithHints extends AuthenticatorSelectionCriteria {
publicKeyCredentialHints?: 'client-device' | 'security-key';
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. The property of publicKey is called hints, not publicKeyCredentialHints
  2. The value is an array of strings, not a string
  3. 'hybrid' is a valid hints string value

Reference: https://www.w3.org/TR/webauthn-3/#dom-publickeycredentialcreationoptions-hints

Suggested change
publicKeyCredentialHints?: 'client-device' | 'security-key';
hints?: Array<'client-device' | 'security-key' | 'hybrid'>;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated value to array of strings and set property name to 'hints'


authenticatorAttachment?: AuthenticatorAttachment;

publicKeyCredentialHints?: 'client-device' | 'security-key';
Copy link
Contributor

Choose a reason for hiding this comment

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

since this 'client-device' | 'security-key' union is used in two spots, should we name it & typedef it?

typedef PublicKeyCredentialType = 'client-device' | 'security-key';

Copy link
Contributor

Choose a reason for hiding this comment

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

I like that idea. Could even use an enum and call it the same as in the spec, PublicKeyCredentialHints

https://www.w3.org/TR/webauthn-3/#enumdef-publickeycredentialhints
https://www.typescriptlang.org/docs/handbook/enums.html#string-enums

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have those cast in a Type now. I'm not entirely clear on how to leverage an enum there but can spend a little more time on it.

@kevinsmaster5 kevinsmaster5 marked this pull request as ready for review April 9, 2024 19:21
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@kevinsmaster5 kevinsmaster5 merged commit 41532cb into main Apr 10, 2024
@kevinsmaster5 kevinsmaster5 deleted the kmas-lg-12571-specify-webauthn-hints branch April 10, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants