Skip to content

Commit 6bc18e5

Browse files
committed
fix(webauthn): use Length.LONG32 for byte[] columns to fix MariaDB row size limit (#286)
VARBINARY(65535) columns exceed MariaDB's InnoDB 65,535-byte row size limit, causing silent table creation failure with ddl-auto: update. Length.LONG32 causes Hibernate to auto-upgrade to LONGBLOB on MariaDB (stored off-page) and stays as bytea on PostgreSQL (no OID issues). Avoids @lob which maps to OID on PostgreSQL per Hibernate docs.
1 parent b441cb5 commit 6bc18e5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/com/digitalsanctuary/spring/user/persistence/model/WebAuthnCredential.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.digitalsanctuary.spring.user.persistence.model;
22

33
import java.time.Instant;
4+
import org.hibernate.Length;
45
import jakarta.persistence.Column;
56
import jakarta.persistence.Entity;
67
import jakarta.persistence.FetchType;
@@ -30,7 +31,7 @@ public class WebAuthnCredential {
3031
private WebAuthnUserEntity userEntity;
3132

3233
/** COSE-encoded public key (typically 77-300 bytes, RSA keys can be larger). */
33-
@Column(name = "public_key", nullable = false, length = 2048)
34+
@Column(name = "public_key", nullable = false, length = Length.LONG32)
3435
private byte[] publicKey;
3536

3637
/** Counter to detect cloned authenticators. */
@@ -58,11 +59,11 @@ public class WebAuthnCredential {
5859
private boolean backupState;
5960

6061
/** Attestation data from registration (can be several KB). */
61-
@Column(name = "attestation_object", length = 65535)
62+
@Column(name = "attestation_object", length = Length.LONG32)
6263
private byte[] attestationObject;
6364

6465
/** Client data JSON from registration (can be several KB). */
65-
@Column(name = "attestation_client_data_json", length = 65535)
66+
@Column(name = "attestation_client_data_json", length = Length.LONG32)
6667
private byte[] attestationClientDataJson;
6768

6869
/** Creation timestamp. */

0 commit comments

Comments
 (0)