-
-
Notifications
You must be signed in to change notification settings - Fork 64
Malformed UTF-8 characters, possibly incorrectly encoded #17
Comments
No one ? @DarkGhostHunter |
I'll take a look, it's very difficult to reproduce for me. |
I have the same error. I fixed it wrapping public static function fromCredentialSource(CredentialSource $source)
{
return ($model = new static)->fill([
$model->getKeyName() => utf8_encode($source->getPublicKeyCredentialId()),
'user_handle' => $source->getUserHandle(),
'type' => $source->getType(),
'transports' => $source->getTransports(),
'attestation_type' => $source->getAttestationType(),
'trust_path' => $source->getTrustPath()->jsonSerialize(),
'aaguid' => $source->getAaguid()->toString(),
'public_key' => utf8_encode($source->getCredentialPublicKey()),
'counter' => $source->getCounter(),
]);
} |
I have the same problem. But crashed on php 7.4.10 |
Okay, I've put an alpha for v3.0. Check it out for any problems. I'll make a full project with it to test it thoroughly. |
Solves DarkGhostHunter#17 (for me)
Figured out that you can just use the |
Fixed. Now it needs some tests. |
@DarkGhostHunter I'm getting this error on Tried in Chrome v90 and Safari on macOS Big Sur on MBP M1 using Touch ID and Yubikey 5C NFC
|
It seems that the JSON type doesn't like SQLSTATE[22032]: <>: 3140 Invalid JSON text: "Invalid value." at position 1 in value for column 'web_authn_credentials.attestation_type'. (SQL: insert into |
@renedekat did you have the same error I have and ever figure it out? I just tried building a new app and I'm still running into this issue with a Yubikey or Touch ID. |
I just managed to resolve the issue by changing the database column for "attestation_type" from JSON to string. I'm not entirely sure what values can be in Alternatively, changing |
@DarkGhostHunter Any news on this? |
Too busy much work |
Thanks for the support. I'll look into it this weekend. |
By the way, is non-labour day here. Today counts as part of the weekend. |
After checking it out, Using Patch incoming now. |
Should be fixed. Hopefully. Otherwise, I'm open to new ways to appease the WebAuthn gods. |
Thanks @DarkGhostHunter ! I'll update my test project this week and give things a go! |
On following environment:
PHP 7.4.8 Laravel v7.21 Default configuration for larapass.php
On registration process, I got the error:
Response for
/webauthn/register/options
:On
/webauthn/register
:Expand
{ "message": "Malformed UTF-8 characters, possibly incorrectly encoded", "exception": "InvalidArgumentException", "file": "/var/www/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php", "line": 75, "trace": [ { "file": "/var/www/vendor/symfony/http-foundation/JsonResponse.php", "line": 50, "function": "setData", "class": "Illuminate\\Http\\JsonResponse", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php", "line": 31, "function": "__construct", "class": "Symfony\\Component\\HttpFoundation\\JsonResponse", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php", "line": 474, "function": "__construct", "class": "Illuminate\\Http\\JsonResponse", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php", "line": 209, "function": "prepareJsonResponse", "class": "Illuminate\\Foundation\\Exceptions\\Handler", "type": "->" }, { "file": "/var/www/app/Exceptions/Handler.php", "line": 53, "function": "render", "class": "Illuminate\\Foundation\\Exceptions\\Handler", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 51, "function": "render", "class": "App\\Exceptions\\Handler", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 130, "function": "handleException", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/var/www/app/Http/Middleware/SetLocale.php", "line": 24, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "App\\Http\\Middleware\\SetLocale", "type": "->" }, { "file": "/var/www/app/Http/Middleware/AuthGates.php", "line": 32, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "App\\Http\\Middleware\\AuthGates", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php", "line": 41, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Routing\\Middleware\\SubstituteBindings", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php", "line": 44, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Auth\\Middleware\\Authenticate", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php", "line": 76, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php", "line": 49, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php", "line": 116, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php", "line": 62, "function": "handleStatefulRequest", "class": "Illuminate\\Session\\Middleware\\StartSession", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Session\\Middleware\\StartSession", "type": "->" }, { "file": "/var/www/vendor/stancl/tenancy/src/Middleware/PreventAccessFromCentralDomains.php", "line": 29, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Stancl\\Tenancy\\Middleware\\PreventAccessFromCentralDomains", "type": "->" }, { "file": "/var/www/vendor/stancl/tenancy/src/Middleware/IdentificationMiddleware.php", "line": 36, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/stancl/tenancy/src/Middleware/InitializeTenancyByDomain.php", "line": 38, "function": "initializeTenancy", "class": "Stancl\\Tenancy\\Middleware\\IdentificationMiddleware", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Stancl\\Tenancy\\Middleware\\InitializeTenancyByDomain", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php", "line": 37, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php", "line": 66, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 103, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 687, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 662, "function": "runRouteWithinStack", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 628, "function": "runRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 617, "function": "dispatchToRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 165, "function": "dispatch", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 128, "function": "Illuminate\\Foundation\\Http\\{closure}", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/var/www/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php", "line": 65, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 21, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 21, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php", "line": 27, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize", "type": "->" }, { "file": "/var/www/vendor/fruitcake/laravel-cors/src/HandleCors.php", "line": 37, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Fruitcake\\Cors\\HandleCors", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php", "line": 63, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode", "type": "->" }, { "file": "/var/www/vendor/fideloper/proxy/src/TrustProxies.php", "line": 57, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 167, "function": "handle", "class": "Fideloper\\Proxy\\TrustProxies", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 103, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 140, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 109, "function": "sendRequestThroughRouter", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/var/www/public/index.php", "line": 55, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" } ] }I think that the reason may be the encoded id/rawId values, because the exception is thrown while attaching the credentials to the user.
As I saw, in
Larapass/src/WebAuthnAuthentication.php
Lines 87 to 92 in fcb0991
Larapass/src/WebAuthn/WebAuthnAttestValidator.php
Line 90 in 0734761
$json['id']
and$json['rawId']
, we got a non UTF-8 string.This provokes the following mysql error:
The text was updated successfully, but these errors were encountered: