WebAuthn icon indicating copy to clipboard operation
WebAuthn copied to clipboard

[3.x] Incorrect uuid value for column webauthn_credentials.aaguid

Open codebarista opened this issue 1 year ago • 3 comments

PHP & Platform

8.3.10 - Alpine Linux v3.20 x64

Database

MariaDB 10.11.8

Laravel version

11.23.4

Have you done this?

  • [X] I have checked my logs and I'm sure is a bug in this package.
  • [X] I can reproduce this bug in isolation (vanilla Laravel install)
  • [X] I can suggest a workaround as a Pull Request

Expectation

When I register a passkey with Google Chrome Profile, I expect that it is stored to the database.

Description

Instead MariaDB sometimes throws a validation exception for aaguid. It works for one host, but not for another (always the same aaguid). So far only in latest Chrome with Chrome Profile for the passkey. The workaround would be to set the aaguid column type to char(36) for MariaDB.

Reproduction

\Laragear\WebAuthn\Models\WebAuthnCredential::create([
    'authenticatable_id' => 1,
    'authenticatable_type' => 'App\Models\User',
    'id' => 'lYcEEbf7tlNrVSLB9m-g_eptRRG7LMOuqNf3PvWLSsM',
    'user_id' => '66d3243c17184e60b90dffedce626d9e',
    'alias' => '',
    'counter' => 0,
    'rp_id' => 'codebarista.test',
    'origin' => 'https://codebarista.test',
    'transports' => '',
    'aaguid' => 'adce0002-35bc-c60a-648b-0b25f1f05503', // original incorrect uuid value
    'public_key' => 'eyJpdiI6IlV5TWpObG1LMS91ODJSelhNNXlkQmc9P...',
    'attestation_format' => 'none',
    'updated_at' => '2024-09-12 17:34:34',
    'created_at' => '2024-09-12 17:34:34',
]);

Stack trace & logs

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect uuid value: 'adce0002-35bc-c60a-648b-0b25f1f05503' for column `webauthn_credentials`.`aaguid` at row 1 (Connection: mariadb, SQL: insert into `webauthn_credentials`...)

codebarista avatar Sep 12 '24 18:09 codebarista