laravel-webauthn
laravel-webauthn copied to clipboard
clientDataJSON base64 padding
webauthn no longer accepts padding in clientDataJSON
this sould be corrected in resources/js/webauthn.js
at WebAuthn.prototype._bufferEncode
a quick temp fix
on project/resources/views/vendor/webauthn/authenticate.blade.php
add
data.response.clientDataJSON = data.response.clientDataJSON.replace('=', '');
to the webauthn.sign
callback
https://github.com/web-auth/webauthn-framework/issues/285
@MordiSacks I found your note helpful, thanks. Were you having an issue with the standard package functionality?
I was attempting to manually login users inside a custom controller. I noted the prepared publicKey using PrepareAssertionData::class
resulted in the padding issue.
Using your quick fix got me passed the issue, without modifying any package files. I haven't dug in to see if it's a simple fix to PR just yet.
I was getting the following errors:
production.ERROR: decodeNoPadding() doesn't tolerate padding {"userId":"123","exception":"[object] (InvalidArgumentException(code: 0): decodeNoPadding() doesn't tolerate padding at /app/path/vendor/paragonie/constant_time_encoding/src/Base64.php:238)
the temp fix above seems to have sorted it.
That temporary fix did not work for me. I had to downgrade web-auth/webauthn-lib
to ~4.0.5
to make it work.