fix: a device does not vouch for a rotation's key state on its own
Material Design conformance / budgets (push) Canceled after 0s
Material Design conformance / tests (push) Canceled after 0s

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 <noreply@anthropic.com>
This commit is contained in:
Kgothatso NgakoandClaude Opus 5.5 committed 2026-11-20 00:08:21 +02:00
1 parent f88c70bee4
commit fc437d0511
1 file changed
+8 -1
@@ -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
}