Skip to content

Commit ce6091c

Browse files
committed
Log cloned authenticators.
1 parent 74ad75d commit ce6091c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

hypha/apply/users/passkey_views.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
verify_registration_response,
2323
)
2424
from webauthn.helpers import base64url_to_bytes, bytes_to_base64url
25+
from webauthn.helpers.exceptions import InvalidAuthenticationResponse
2526
from 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",

0 commit comments

Comments
 (0)