-
Notifications
You must be signed in to change notification settings - Fork 166
Add analytics property for WebAuthn sign-in frontend error #9611
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -62,6 +62,18 @@ | |||||||||||||
| ) | ||||||||||||||
| end | ||||||||||||||
| end | ||||||||||||||
|
|
||||||||||||||
| context 'with client-side webauthn error as blank string' do | ||||||||||||||
| let(:webauthn_error) { '' } | ||||||||||||||
|
|
||||||||||||||
| it 'returns successful result excluding frontend_error' do | ||||||||||||||
| expect(result.to_h).to eq( | ||||||||||||||
| success: true, | ||||||||||||||
| multi_factor_auth_method: 'webauthn', | ||||||||||||||
| webauthn_configuration_id: webauthn_configuration.id, | ||||||||||||||
| ) | ||||||||||||||
| end | ||||||||||||||
| end | ||||||||||||||
| end | ||||||||||||||
|
|
||||||||||||||
| context 'when the input is invalid' do | ||||||||||||||
|
|
@@ -136,20 +148,20 @@ | |||||||||||||
| success: false, | ||||||||||||||
| error_details: { webauthn_configuration: { blank: true } }, | ||||||||||||||
| multi_factor_auth_method: 'webauthn', | ||||||||||||||
| webauthn_configuration_id: nil, | ||||||||||||||
| ) | ||||||||||||||
| end | ||||||||||||||
| end | ||||||||||||||
|
|
||||||||||||||
| context 'when a client-side webauthn error is present' do | ||||||||||||||
| let(:webauthn_error) { 'Unexpected error!' } | ||||||||||||||
| let(:webauthn_error) { 'NotAllowedError' } | ||||||||||||||
|
|
||||||||||||||
| it 'returns unsuccessful result including client-side webauthn error text' do | ||||||||||||||
| expect(result.to_h).to eq( | ||||||||||||||
| success: false, | ||||||||||||||
| error_details: { webauthn_error: { webauthn_error: true } }, | ||||||||||||||
|
||||||||||||||
| error_details: { webauthn_error: { webauthn_error: true } }, | |
| error_details: { webauthn_error: { NotAllowedError: true } }, |
Or:
| error_details: { webauthn_error: { webauthn_error: true } }, | |
| error_details: { webauthn_error: { not_allowed_error: true } }, |
Or some extra processing to trim the redundant suffix:
| error_details: { webauthn_error: { webauthn_error: true } }, | |
| error_details: { webauthn_error: { not_allowed: true } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the third version leave the door open for other types of webauthn_errors? I'm not sure if that sort of scalability is likely but if it is I think that's a strong candidate. It seems pretty descriptive regardless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think I like it as far as providing the actual detail relevant for the field, but my main concern is that it's not obvious the mapping between the original JavaScript-derived error name and the resulting logged key name, which would I expect would be derived by some opaque logic like javascript_error_name.underscore.tr('_error', ''). And the "Error" suffix of JavaScript error names is only a standard convention, not strictly mandatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually thinking I might go a different direction with this and use ActiveRecord's built-in absence validator for this, which seems like a nice compromise between the challenges above and trying to avoid having a redundant webauthn_error subproperty.
I'll plan tackle that in a quick follow-on pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll plan tackle that in a quick follow-on pull request.
See #9614
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is being logged on the
Multi-Factor Authenticationevent, it should probably be documented in the arguments for that method, and qualified as relating specifically to "WebAuthn".Though maybe that extra friction is enough to warrant persuing the alternative instead.