From 8092bb37b983b8c21a54b25385dbe8d111b09f5a Mon Sep 17 00:00:00 2001 From: 0x0fbc <10455804+0x0fbc@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:18:51 -0400 Subject: [PATCH] override charset on duo state column to ascii for mysql --- migrations/mysql/2024-06-05-131359_add_2fa_duo_store/up.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/migrations/mysql/2024-06-05-131359_add_2fa_duo_store/up.sql b/migrations/mysql/2024-06-05-131359_add_2fa_duo_store/up.sql index 6cd1cdc5..9a619f65 100644 --- a/migrations/mysql/2024-06-05-131359_add_2fa_duo_store/up.sql +++ b/migrations/mysql/2024-06-05-131359_add_2fa_duo_store/up.sql @@ -1,5 +1,8 @@ CREATE TABLE twofactor_duo_ctx ( - state VARCHAR(1024) NOT NULL, + -- For mysql, the character set on state is overridden to ascii because the utf8mb4 database charset recommended in + -- the Vaultwarden docs causes 1 character to consume 4 bytes, exceeding innodb's 3072 max key size if we want to + -- accommodate the largest supported state size. This isn't a problem for nonce since it's not a key for the table. + state VARCHAR(1024) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL, user_email VARCHAR(255) NOT NULL, nonce VARCHAR(1024) NOT NULL, exp BIGINT NOT NULL,