fix(auth): store passkey backup flags so synced passkeys verify
Chart Release / chart (push) Successful in 19s
Server Deploy / deploy (push) Successful in 3m4s

go-webauthn refuses an assertion whose Backup Eligible flag differs from
the stored credential's. The flag was never stored, so it compared against
false and every synced passkey (iCloud Keychain, Google Password Manager,
1Password) failed with "Backup Eligible flag inconsistency" - in
passwordless sign-in, second-factor sign-in and step-up alike.

Registration now stores BackupEligible and BackupState. Rows registered
before this have no baseline, so their first verified assertion adopts the
signed flag and records it; a recorded value always stands, so a genuine
change is still refused.
This commit is contained in:
2026-09-16 15:03:54 +00:00
parent b1193c59e3
commit 934501f4ec
6 changed files with 83 additions and 9 deletions
+8
View File
@@ -55,6 +55,14 @@ type WebAuthnCredential struct {
AAGUID []byte `bson:"aaguid" json:"-"`
Transports []string `bson:"transports,omitempty" json:"transports,omitempty"`
// BackupEligible is whether the credential can sync between devices. It
// never changes for a real credential, and go-webauthn refuses an assertion
// whose flag differs from this one, so it must be stored. Nil only on rows
// registered before it was recorded; see auth.backupEligibleFor.
BackupEligible *bool `bson:"backup_eligible,omitempty" json:"-"`
// BackupState is whether it is currently synced. It may change.
BackupState bool `bson:"backup_state" json:"-"`
// CredentialIDHex is the browser-facing identifier for rename and delete.
// The raw bytes never reach a URL.
CredentialIDHex string `bson:"credential_id_hex" json:"id"`