27a13a833aa5

M11/COR-014: verify peer is paired before running blob sync session

time
2026-05-16 03:10 UTC · 5 months ago
machine
koh2
parent
ddca1d438ac7
1 file src/background/messages.ts+10 −0
src/background/messages.ts+10 −0
@@ -208,6 +208,16 @@208208 }209209 210210 async function doVaultSync(ip: string, publicKeyHex: string): Promise<SyncResult> {211+  // Defensive: refuse to drive a sync to a key not in the paired-devices212+  // list. The WebSocket transport already authenticates the peer via Noise213+  // NK + the initiator auth proof (H1), but pinning the key to the paired214+  // set here makes "talk to anyone matching this static key" the only path215+  // to vault application — there is no orphan-key window between pair and216+  // sync (M11/COR-014).217+  const paired = await getPairedDevices();218+  if (!paired.some(d => d.x25519PublicKey === publicKeyHex)) {219+    return { status: 'errored', applied: false, error: 'remote_not_paired' };220+  }211221   try {212222     const identity = await vault.getSyncIdentity();213223     const transport = await createWebSocketSyncTransport(

view file