File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 verify_registration_response ,
2323)
2424from webauthn .helpers import base64url_to_bytes , bytes_to_base64url
25+ from webauthn .helpers .exceptions import InvalidAuthenticationResponse
2526from webauthn .helpers .structs import (
2627 AuthenticationCredential ,
2728 AuthenticatorAssertionResponse ,
@@ -253,6 +254,21 @@ def passkey_auth_complete(request):
253254 user = passkey .user
254255 except Passkey .DoesNotExist :
255256 return JsonResponse ({"error" : _ ("Unknown credential" )}, status = 400 )
257+ except InvalidAuthenticationResponse as exc :
258+ if "sign count" in str (exc ).lower ():
259+ logger .error (
260+ "Passkey sign count regression — possible cloned authenticator"
261+ " (credential=%s): %s" ,
262+ credential_id_b64 ,
263+ exc ,
264+ )
265+ else :
266+ logger .warning (
267+ "Passkey authentication verification failed for credential %s: %s" ,
268+ credential_id_b64 ,
269+ exc ,
270+ )
271+ return JsonResponse ({"error" : _ ("Verification failed" )}, status = 400 )
256272 except Exception :
257273 logger .warning (
258274 "Passkey authentication verification failed for credential %s" ,
You can’t perform that action at this time.
0 commit comments