Move Aaguid call in webauthn Setup form #11248
Conversation
|
Context: #11138 (comment) Looks like there's an issue to be resolved from the build. |
|
It looks like attestation response could also throw an error when we call for authenticator data. So we would need to do a begin and rescue clause as well. |
I'm not really sure I follow from the code how that could happen, since |
|
Oh, I see, it's not the call to |
| def aaguid | ||
| begin | ||
| @aaguid ||= attestation_response&.authenticator_data&.aaguid | ||
| rescue StandardError | ||
| nil | ||
| end | ||
| end |
There was a problem hiding this comment.
- We can use a method-level rescue to flatten this.
- I think we can be more targeted in the error we're looking for. Based on where I suspect it's being raised, maybe we can rescue
WebAuthn::AuthenticatorDataFormatError? - Memoizing won't do much here if the value is
nil, since||=will still evaluate for anilvalue
| def aaguid | |
| begin | |
| @aaguid ||= attestation_response&.authenticator_data&.aaguid | |
| rescue StandardError | |
| nil | |
| end | |
| end | |
| def aaguid | |
| attestation_response&.authenticator_data&.aaguid | |
| rescue WebAuthn::AuthenticatorDataFormatError | |
| nil | |
| end |
app/forms/webauthn_setup_form.rb
Outdated
| rescue WebAuthn::AuthenticatorDataFormatError | ||
| nil |
There was a problem hiding this comment.
Ok looks like we are getting StandardError after all? 🤷
From adding a binding.pry and running failing spec rspec ./spec/forms/webauthn_setup_form_spec.rb:226.
From: /Users/andrewmduthie/Documents/Code/identity-idp/app/forms/webauthn_setup_form.rb:167 WebauthnSetupForm#aaguid:
163: def aaguid
164: attestation_response&.authenticator_data&.aaguid
165: rescue => e
166: binding.pry
=> 167: nil
168: end
[1] pry(#<WebauthnSetupForm>)> e
=> #<StandardError: StandardError>
Curious where this is being raised...
| rescue WebAuthn::AuthenticatorDataFormatError | |
| nil | |
| rescue StandardError | |
| nil |
There was a problem hiding this comment.
Oh.... it's because it's what we stub 😕
identity-idp/spec/forms/webauthn_setup_form_spec.rb
Lines 222 to 224 in f982fda
I'm not sure that stub accurately reflects reality.
There was a problem hiding this comment.
Yea I think we can change it to reflect webauthn data error
There was a problem hiding this comment.
But it doesnt explain why the other tests are failing as well.
* changelog: Internal, Webauthn Setup, move aaguid call in webauthn setup form * remove aaguid * do rescue for aaguid * rescue authenticator data format * change to standard erorr
No description provided.