Skip to content

Commit 6ff631b

Browse files
authored
Use the generic WebAuthn base exception (#19151)
1 parent 276b96b commit 6ff631b

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

warehouse/utils/webauthn.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@
1111
parse_authentication_credential_json,
1212
parse_registration_credential_json,
1313
)
14-
from webauthn.helpers.exceptions import (
15-
InvalidAuthenticationResponse,
16-
InvalidAuthenticatorDataStructure,
17-
InvalidRegistrationResponse,
18-
UnsupportedPublicKeyType,
19-
)
14+
from webauthn.helpers.exceptions import WebAuthnException
2015
from webauthn.helpers.options_to_json import options_to_json
2116
from webauthn.helpers.structs import (
2217
AttestationConveyancePreference,
@@ -128,11 +123,7 @@ def verify_registration_response(response, challenge, *, rp_id, origin):
128123
expected_origin=origin,
129124
require_user_verification=False,
130125
)
131-
except (
132-
InvalidAuthenticatorDataStructure,
133-
InvalidRegistrationResponse,
134-
UnsupportedPublicKeyType,
135-
) as e:
126+
except WebAuthnException as e:
136127
raise RegistrationRejectedError(str(e))
137128

138129

@@ -163,7 +154,7 @@ def verify_assertion_response(assertion, *, challenge, user, origin, rp_id):
163154
credential_current_sign_count=current_sign_count,
164155
require_user_verification=False,
165156
)
166-
except InvalidAuthenticationResponse:
157+
except WebAuthnException:
167158
pass
168159

169160
# If we exit the loop, then we've failed to verify the assertion against

0 commit comments

Comments
 (0)