Closed Jorgu5 closed 1 year ago
Hi,
It looks like the type is not correctly encoded.
I am not sure the serialization of the array is a good practice. You can directly rave the credential as json string by using json_encode($credential);
and the method PublicKeyCredentialSource::createFromArray(json_decode(..., true));
OK I have found the reason, the update_user_meta() in Wordpress is using wp_unslash() which is removing the slashes and it's also automatically serializing the array if it's not a string. The json_encode / decode is not working either as i'm getting corrupted JSON when trying to decode. I'll have to write my own handler for adding public key resource into database then.
I have another issue non-related to WP that occured after update to 4.7.1 (everything works properly on 4.7.0) I'm getting this error during registration ceremony. What changes in recent version could affect it?
Webauthn\AuthenticatorSelectionCriteria::createFromArray(): Argument #1 ($json) must be of type array, Webauthn\AuthenticatorSelectionCriteria given, called in /var/www/html/wp-content/plugins/wp-passkeys/vendor/web-auth/webauthn-lib/src/PublicKeyCredentialCreationOptions.php on line 276
It's happening when i'm retrieving the credential options PublicKeyCredentialCreationOptions::createFromArray($options)
This data is saved in session though, not in database, and the data is not affected by any WP methods during the process.
This is how the $json object looks like when being passed to createFromArray
Webauthn\AuthenticatorSelectionCriteria::createFromArray(): Argument #1 ($json) must be of type array, Webauthn\AuthenticatorSelectionCriteria given, called in /var/www/html/wp-content/plugins/wp-passkeys/vendor/web-auth/webauthn-lib/src/PublicKeyCredentialCreationOptions.php on line 276
Looks similar to #483.
Can you make sure ->jsonSerialized()
is not called as mentioned here?
Works!
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.
Version(s) affected
4.7.1
Description
When i'm trying to get my credentials from database with
PublicKeyCredentialSource::createFromArray
it fails on trustpath key. My credential source before unserialization looks like thatIn
TrustPathLoader.php
I can see, that it throws an error when it checks ifWebauthnTrustPathEmptyTrustPath
class_exists, line 21.How to reproduce
$publicKeyCredentialSource->jsonSerialize()
during registration process.Possible Solution
No response
Additional Context
No response