Skip to content

[6.x] Fix creating passkeys with JSON session serialization#14448

Merged
jasonvarga merged 3 commits into6.xfrom
passkey-challenge-serialization
Apr 7, 2026
Merged

[6.x] Fix creating passkeys with JSON session serialization#14448
jasonvarga merged 3 commits into6.xfrom
passkey-challenge-serialization

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

@duncanmcclean duncanmcclean commented Apr 7, 2026

This pull request fixes an issue when creating passkeys alongside the json serializer for sessions, which was made the default in Laravel 13.

The WebAuthn challenge is generated using random_bytes(), which produces binary data. Since json_encode() cannot encode binary data (it returns false for invalid UTF-8), the session write fails silently, resulting in an empty session file and the user being logged out.

This PR fixes it by base64 encoding the challenge before storing it in the session, ensuring compatibility with both PHP and JSON session serialization methods.

@duncanmcclean duncanmcclean changed the title Fix WebAuthn challenge storage for JSON session serialization [6.x] Fix WebAuthn challenge storage for JSON session serialization Apr 7, 2026
@duncanmcclean duncanmcclean changed the title [6.x] Fix WebAuthn challenge storage for JSON session serialization [6.x] Fix creating passkeys with JSON session serialization Apr 7, 2026
duncanmcclean and others added 2 commits April 7, 2026 15:58
@jasonvarga jasonvarga merged commit 01395e6 into 6.x Apr 7, 2026
17 checks passed
@jasonvarga jasonvarga deleted the passkey-challenge-serialization branch April 7, 2026 17: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