Fix OTK-count semantics: absent is zero under sync v2, unknown under sliding sync #90

Closed
opened 2026-08-13 21:35:33 +02:00 by thecrealm · 0 comments
Owner

Review finding (2026-08-13 recommendation review), CR-6/§10.4/§3.3.

SyncBatch.oneTimeKeyCounts is nullable (absent = null), but SessionCrypto.kt:92 collapses null to emptyMap and AccountKeeper.updateKeyCounts (AccountKeeper.kt:81) skips replenishment when signed_curve25519 is absent — for BOTH sources.

Per matrix-rust-sdk fix 6780 (they split receive_sync_changes by sync flavour for exactly this): under sync v2 an absent device_one_time_keys_count means ZERO remaining keys; under MSC4186 an absent e2ee extension means no information. Current katrix behavior is correct for sliding only. Failure mode is silent OTK exhaustion — peers get UTDs (rust-sdk v2 bug manifested as no one-time keys being uploaded).

Acceptance: SyncBatch carries per-source absence semantics (v2 absent means zero, sliding absent means unknown); tests on both sources; spec §10.4 note.

Review finding (2026-08-13 recommendation review), CR-6/§10.4/§3.3. SyncBatch.oneTimeKeyCounts is nullable (absent = null), but SessionCrypto.kt:92 collapses null to emptyMap and AccountKeeper.updateKeyCounts (AccountKeeper.kt:81) skips replenishment when signed_curve25519 is absent — for BOTH sources. Per matrix-rust-sdk fix 6780 (they split receive_sync_changes by sync flavour for exactly this): under sync v2 an absent device_one_time_keys_count means ZERO remaining keys; under MSC4186 an absent e2ee extension means no information. Current katrix behavior is correct for sliding only. Failure mode is silent OTK exhaustion — peers get UTDs (rust-sdk v2 bug manifested as no one-time keys being uploaded). Acceptance: SyncBatch carries per-source absence semantics (v2 absent means zero, sliding absent means unknown); tests on both sources; spec §10.4 note.
thecrealm added
now
and removed
next
labels 2026-08-21 10:52:37 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
thecrealm/katrix#90
No description provided.