Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webauthn\CollectedClientData::createFormJson not working #510

Closed
hulvat opened this issue Nov 11, 2023 · 2 comments
Closed

Webauthn\CollectedClientData::createFormJson not working #510

hulvat opened this issue Nov 11, 2023 · 2 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@hulvat
Copy link

hulvat commented Nov 11, 2023

Version(s) affected

4.7

Description

Hi
I got error could not load data when a called method

$publicKeyCredentialLoader->load($data);

I found that this method

createFormJson in Webauthn\CollectedClientData call this code on line 91
$rawData = Base64UrlSafe::decodeNoPadding($data);

but when i changed to
$rawData = base64_decode($data);

everythings work ok.

How to reproduce

just send this base 64 encoded string to method createFormJson and it will throw error

eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiWVdFIiwib3JpZ2luIjoiaHR0cDovL2xvY2FsaG9zdDozMDAwIiwiY3Jvc3NPcmlnaW4iOmZhbHNlfQ==

despite the fact, that this string is valid base64 encoded string

Possible Solution

change
$rawData = Base64UrlSafe::decodeNoPadding($data);
to
$rawData = base64_decode($data);

Additional Context

No response

@Spomky
Copy link
Contributor

Spomky commented Nov 12, 2023

Hi @hulvat,

The expected encoding is Base64Url without padding, not base64. This was changed in the previous minor release to conform to the Webauthn specifications. This behavior will not be changed because it will call into question the library's compliance.

What tool do you use to send the data? If you use SimpleWebauthn, the data should be encoded correctly and the error will not occur.

@Spomky Spomky self-assigned this Nov 12, 2023
@Spomky Spomky added the on-hold label Nov 12, 2023
@Spomky Spomky removed the on-hold label Jan 2, 2024
@Spomky Spomky added the wontfix This will not be worked on label Feb 5, 2024
@Spomky Spomky closed this as completed Feb 23, 2024
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants