Skip to content

webauthn, userHandle and base64 encoding - #19536

Merged
brandonkelly merged 2 commits into
5.xfrom
bugfix/19530
Sep 2, 2026
Merged

brandonkelly merged 2 commits into
5.xfrom
bugfix/19530

Conversation

@i-just

@i-just i-just commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Description

This PR simplifies passkey verification for single- and double-base64-encoded userHandle.

When a passkey is created on e.g. 5.7.11 (webauthn 4.9.x), the credential’s userHandle is base64 encoded once.
When a passkey is created on 5.9.16+ (webauthn 5.2.x), the credential’s userHandle is base64 encoded twice.

When logging someone in via passkeys route, it looked like we’ve always been checking userHandle against base64 encoded User UID (in Auth::verifyPasskey() > $this->webauthnServer()->getAuthenticatorAssertionResponseValidator()->check()) as the Auth::passkeyUserEntity() was base64 encoding the user’s UID, but then the PublicKeyCredentialUserEntity::createFromArray() was decoding it again, so effectively the check was run on two raw UIDs and we had a match.

With the update to webauthn v5 (5.9.16+) and the removal of PublicKeyCredentialUserEntity::createFromArray() method, the user entity is now this object, and there’s no decoding step there, so with passkeys created in webauthn v4, we were comparing users’ UID to the base64 version of it.

Related issues

#19530

@i-just
i-just requested a review from brandonkelly September 2, 2026 09:05
[ci skip]
@brandonkelly
brandonkelly merged commit 44bf039 into 5.x Sep 2, 2026
2 checks passed
@brandonkelly
brandonkelly deleted the bugfix/19530 branch September 2, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants