Repository navigation
Strict channels: modified-client tests, rewind and roster fixes, who changed while away - #2470
Merged
Merged
Conversation
Rest of #1924, part of #2251. `teamcraft-crypto/strict-channels` stays off; nothing here turns it on. Tests with a modified client in the core suite: the core's `test-hooks` feature (a dev-dependency of its own suite only, never in an app) gives `Client::commit_unchecked_change`, which commits a signed change past the committer's own verdict via crypto's `test_hooks::set_unchecked_commits`, and `FakeServer::withhold_roster` shows one reader an older roster. They found three bugs: - Two admins continuing at once: the second rewind dropped the first admin's continuation, which its committer and the members who merged it were already past, so the group parted. A rewind now names the refused commit it replaces (`replaces`); the server rewinds only while that commit holds the epoch, else it is an epoch conflict and the second admin catches up. Without the field, as before. - A workspace signer's commit in a strict channel was processed, the roster read and the commit processed again on the same group, but openmls spends the epoch's handshake secret on the first decrypt: the retry failed ("deleted to preserve forward secrecy") and the device stopped. The app now decides from the unencrypted authenticated data whether the commit may need the roster (`mls::strict_commit_reads_roster`), reads it first and processes once; a roster that still can't judge makes the device go past the entry and ask to be added back. This also fixes an honest-server stop: a removal by a just-promoted workspace admin was refused on the device's older roster, and nobody else had stopped to continue. - A welcome back was opened from any member when the device had kept its group: dropping the group for the welcome dropped the rejoin record with it, so the sender check never ran. The check now takes the rejoin from its caller. After an add-back into a channel the device knew strict, it writes a line per user new or gone since its last tree (kept when the group is dropped for the welcome): `ConversationEvent::ChangedWhileAway`, derived and hidden if a member sends one; desktop and web render it (en, de). Android and iOS: #2464. The held welcome's joined/gone are against that tree too (before: against none). Refs #2251 Signed-off-by: Jan Runkel <jan.runkel@zeitgleich.de>
…a hook The web build without `strict-channels` compiles `strict_channels_off.rs`, which has no `strict_stop`: `post_commit` asks `strict_rewind_replaces` instead (none in that build). Refs #2251 Signed-off-by: Jan Runkel <jan.runkel@zeitgleich.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2251 (the rest of #1924,
docs/e2ee.md§4.6.2).teamcraft-crypto/strict-channelsstays off; nothing here turns it on.Modified-client tests in the core suite
teamcraft-coregets atest-hooksfeature, enabled only through a dev-dependency of the crate on itself, so no app build carries it:Client::commit_unchecked_changesigns and commits a membership change past the committer's own verdict (viateamcraft_crypto::mls::test_hooks::set_unchecked_commits), the way a modified client could (finding 3).FakeServer::withhold_roster(reader, last_shown)shows one reader an older workspace roster.tests/suite/strict_channels.rs: a plain member's signed removal refused alike on every member and "Remove {name} and continue" through the rewind; a plain member's signed addition refused alike and "Continue"; two admins continuing at once (one removes, one doesn't; both remove); a withheld roster that makes a device fall out and an admin's welcome that brings it back; a member's welcome held until the user takes it afterstrict_rejoin_wait(accept_strict_rejoin); a lagging roster on an honest server.Bugs the tests found, fixed
PostMlsCommitRequest.replaces, the stop's queue entry). The server (DB transaction,rewind_mls) rewinds only while that commit still holds the epoch. Otherwise it answers with an epoch conflict, and the second admin catches up: the first commit ends its stop. A rewind without the field (an older app) behaves as before. Includes a new sqlx query (.sqlx/query-c9d2…json, generated for that query only) and a server test.mls::strict_commit_reads_roster, with crypto tests). It reads the roster first, as the design says, and processes the commit once. If the roster still can't judge the signer, the device moves past the entry and asks to be added back right away. This also fixes a stop on an honest server: a removal by a workspace admin promoted just before was refused on the device's older roster, and that device stopped with nobody else stopped to continue from.join_from_welcomedrops the group before opening the welcome, which also deleted the rejoin record. Socheck_strict_welcomesaw no fallen-out device and opened any member's welcome at once (finding 2 again). The check now getsis_rejoinfrom its caller.Who is new or gone after an add-back (tree diff lines)
ConversationEvent::ChangedWhileAway. The line is derived from the welcome it opened, and a member's message of that kind stays hidden. The held welcome'sjoined/goneare now against that tree too; before, they were against an empty one.ws-joined-while-away,ws-gone-while-away, en and de). Android and iOS pass over the event for now: Strict channels: show the lines of who is new or gone after an add-back on Android and iOS #2464.Not in this PR
Checks
cargo test -p teamcraft-core --features ui --test suite: all 1218 pass (with CI'sRUST_MIN_STACK). The strict-channel module alone: 34 tests.cargo test -p teamcraft-crypto --lib strict: 60 pass.cargo test -p teamcraft-server --features integration --test suite mls::rewind: 6 pass, against the local test Postgres.teamcraft-uiworkspace_eventtests and the core lib tests pass.-D warningsand fmt on the touched crates (core withui, withsealed-sqlitealone, and withstrict-channels).strict_channels_off.rs), because this machine has no wasm target. CI covers it.Refs #2251
🤖 Generated with Claude Code