feat(federation): add nonceSupported column to federation_peers (FED-008)

Adds nonce_supported INTEGER column to the federation_peers table in both
the Drizzle schema definition and via a safe ALTER TABLE migration, enabling
the auto-ratchet mechanism for replay attack protection.
This commit is contained in:
Jannis Braun
2026-03-31 18:09:40 +02:00
parent d2073efdd7
commit 2f9cce9d38
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -2098,4 +2098,9 @@ function migrateGeneralizeOutbox(db: Database.Database): void {
db.exec(`PRAGMA foreign_keys = ON`);
}
}
// ─── FED-008: Add nonceSupported column for replay attack protection ───────
try {
db.exec(`ALTER TABLE federation_peers ADD COLUMN nonce_supported INTEGER NOT NULL DEFAULT 0`);
} catch { /* column already exists */ }
}
+1
View File
@@ -319,6 +319,7 @@ export const federationPeers = sqliteTable('federation_peers', {
consecutiveFailures: integer('consecutive_failures').default(0),
lastSyncedAt: integer('last_synced_at').default(0),
remoteMaxUploadSize: integer('remote_max_upload_size'),
nonceSupported: integer('nonce_supported').notNull().default(0),
createdAt: integer('created_at').notNull(),
});