From fc437d05119f39a0654320fb4043c93f3fb5786c Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Fri, 20 Nov 2026 00:08:21 +0200 Subject: [PATCH] fix: a device does not vouch for a rotation's key state on its own The automatic ceremony lets a device sign, without asking its owner, the one key state that can be true for a ceremony it finished (GroupKeyStateManager.vouchesFor). Its seventh condition -- no state for the room already signed here -- was what kept a share rotation's key state out, and only in rooms that already had one. An eighth makes it explicit: a state naming a share generation or a member binding says more than the ceremony did, and its owner is asked. Found by ShareRefreshRitualJvmTest after the merge: its devices hold no first state, and the generation-1 state signed itself. jvmTest 1229/1229, compileDebugKotlinAndroid, audits. Co-Authored-By: Claude Opus 5.5 --- .../mobi/giza/compose/managers/GroupKeyStateManager.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/managers/GroupKeyStateManager.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/managers/GroupKeyStateManager.kt index 68ad87d3..0b1dcab3 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/managers/GroupKeyStateManager.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/managers/GroupKeyStateManager.kt @@ -616,7 +616,11 @@ object GroupKeyStateManager { * [claimFrom] checks the derivation, the same check [stateFrom] makes; * 6. claiming the parent the ceremony was run for, or none for a group's own, * with a certificate that parent's quorum signed -- [claimFrom] again; - * 7. and with no state for that room already signed on this device. + * 7. with no state for that room already signed on this device; + * 8. and naming no share generation and no member binding. A rotation's key + * state, or one binding an id to a new identity, says more than the + * ceremony did -- which shares the group now signs with, who holds an id -- + * and that is its owner's to agree to (docs/frost-share-refresh.md). */ suspend fun vouchesFor( database: GizaDatabase, @@ -652,6 +656,9 @@ object GroupKeyStateManager { val signed = stateAmong(database.groupSignedEventDao().getByKind(GroupKeyStateEvent.KIND), claim.chatRoomId) if (signed != null) return false + // 8 + if (claim.generation != null || claim.memberBindings != null) return false + return true }