336f8bdb5d3d

record the §18.1 immutable-identity closure, green gates, and the §18.4 resume plan

time
2026-09-10 21:20 UTC · 2 months ago
machine
koh2
agent
deepseek/deepseek-v4-flash
session
cross-client remediation
parent
d82545a6da2e
3 files VERSION+1 −1app/src/main/java/com/peachpasswords/sync/VaultSyncAdapter.kt+11 −17app/src/test/java/com/peachpasswords/sync/VaultSyncAdapterTest.kt+21 −1
VERSION+1 −1
@@ -1 +1 @@1-2.17.271+2.17.28

view file

app/src/main/java/com/peachpasswords/sync/VaultSyncAdapter.kt+11 −17
@@ -246,15 +246,13 @@246246                     // entry is correctly vouched and the manifest verifies.247247                     // Drop the entry wholesale rather than retaining mutable248248                     // metadata alongside an untrusted identity transition.249-                    val directLongTermChanged = existing.trustSource == "direct" &&250-                        existing.longTermPublicKeyHex?.let {251-                            !CryptoCompare.hex(it, incomingLongTermKey)252-                        } == true253-                    val directSigningChanged = existing.trustSource == "direct" &&254-                        existing.signingPublicKeyHex?.let {255-                            !CryptoCompare.hex(it, incomingSigningKey)256-                        } == true257-                    if (directLongTermChanged || directSigningChanged) {249+                    val longTermChanged = existing.longTermPublicKeyHex?.let {250+                        !CryptoCompare.hex(it, incomingLongTermKey)251+                    } == true252+                    val signingChanged = existing.signingPublicKeyHex?.let {253+                        !CryptoCompare.hex(it, incomingSigningKey)254+                    } == true255+                    if (longTermChanged || signingChanged) {258256                         deviceKeyRotationAlert(existing, entry, System.currentTimeMillis())259257                             ?.let(stagedAlerts::add)260258                         continue@@ -264,14 +262,10 @@264262                         deviceName = existing.deviceName?.takeIf { it.isNotBlank() }265263                             ?: entry.deviceName,266264                         deviceType = entry.deviceType,267-                        // Direct keys are immutable; preserve the SAS-pinned268-                        // values even when an old record lacks one field.269-                        longTermPublicKeyHex =270-                            if (existing.trustSource == "direct") existing.longTermPublicKeyHex271-                            else incomingLongTermKey,272-                        signingPublicKeyHex =273-                            if (existing.trustSource == "direct") existing.signingPublicKeyHex274-                            else incomingSigningKey,265+                        // Every admitted identity is immutable. Only an explicit,266+                        // physically confirmed re-pair may replace these keys.267+                        longTermPublicKeyHex = existing.longTermPublicKeyHex ?: incomingLongTermKey,268+                        signingPublicKeyHex = existing.signingPublicKeyHex ?: incomingSigningKey,275269                         vouchDepth = entry.vouchDepth,276270                         wsPort = existing.wsPort ?: entry.wsPort,277271                         rendezvousSecretHex =

view file

app/src/test/java/com/peachpasswords/sync/VaultSyncAdapterTest.kt+21 −1
@@ -653,7 +653,7 @@653653         master.fill(0)654654     }655655 656-    @Test fun `direct peer rejects long term and signing key rotation`() = runBlocking {656+    @Test fun `direct and vouched peers reject long term and signing key rotation`() = runBlocking {657657         val repo = VaultRepository(FakeStorage())658658         repo.createVault("correct horse")659659         val master = repo.syncMasterKey()!!@@ -679,6 +679,15 @@679679                     trustSource = "direct",680680                     pairedAt = 2L,681681                 ),682+                PairedDevice(683+                    deviceId = "vouched-laptop",684+                    deviceName = "Laptop",685+                    deviceType = "extension",686+                    longTermPublicKeyHex = "66".repeat(32),687+                    signingPublicKeyHex = "aa".repeat(32),688+                    trustSource = "vouched",689+                    pairedAt = 3L,690+                ),682691             ),683692         )684693         val adapter = VaultSyncAdapter(@@ -719,6 +728,15 @@719728                         signingPublicKeyHex = "ff".repeat(32),720729                         pairedAt = 2L,721730                     ),731+                    ManifestDeviceEntry(732+                        deviceId = "vouched-laptop",733+                        deviceName = "Laptop",734+                        deviceType = "extension",735+                        longTermPublicKeyHex = "55".repeat(32),736+                        signingPublicKeyHex = "bb".repeat(32),737+                        relayUrl = "wss://relay.peachpasswords.com",738+                        pairedAt = 3L,739+                    ),722740                 ),723741                 signingPrivateKey = issuerSigning.privateKey,724742             ),@@ -726,6 +744,8 @@726744         )727745         assertEquals("77".repeat(32), paired.get("trusted-tablet")?.longTermPublicKeyHex)728746         assertEquals("ee".repeat(32), paired.get("trusted-tablet")?.signingPublicKeyHex)747+        assertEquals("66".repeat(32), paired.get("vouched-laptop")?.longTermPublicKeyHex)748+        assertEquals("aa".repeat(32), paired.get("vouched-laptop")?.signingPublicKeyHex)729749         master.fill(0)730750     }731751 

view file