Skip to content

fix(sync): a key reset that keeps your data gets past the server, starts only where it can, and warns a team's only owner or admin - #4755

Merged
datlechin merged 5 commits into
mainfrom
fix/keys-reset-kinds
Nov 30, 2026
Merged

datlechin merged 5 commits into
mainfrom
fix/keys-reset-kinds

Conversation

@datlechin

@datlechin datlechin commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • A reset that keeps your passwords (kind 2) now proposes under this device's own key device and proves with its DSK, so the server's approved-row check and its DSK check both pass. The server refused every kind 2 proposal before. Kind 3 still draws new device keys; the server does not change.
  • The fake server judges a key.reset as the real one does: kind 2 from a row its proof makes approved, kind 3 from one it does not, and a device certificate naming the proof's key.
  • A reset starts only where it can: kind 2 on an approved device, kind 3 on one that needs approval or that a rotation left out. Other locks refuse as sync.locked, a wrong kind or a second pending reset as sync.not_allowed, so none reads as the server's refusal.
  • A kind 3 reset a server restore lost: resume_reset returns step_up_required after raising its notice, so Confirm It's You… steps up and sends it again, and the notice goes once it is up.
  • After an activation, one team that refuses the new key.member (no seat) stops no other. activate_reset returns the teams that wait with their codes, the reset reads as done, and later passes retry them.
  • A kind 3 proposer with no pin ends its reset on a certificate at its av that its own IK signs, so a rotation ends it instead of leaving it pending with a Finish that fails with sync.unknown.
  • Ending a kind 2 reset drops only the device certificate the reset's ASK signed, so a rotation of this device waiting at the same id stays whole.
  • A team's only owner or admin, while another member holds its key, is warned in the reset dialog to make another holder an admin first (never blocked). After the reset that team's keys page says to make a holder an admin in the web portal. The core decides which teams (TeamKeys::sole_confirmer, teams_only_this_account_confirms).
  • Mac: Reset and Start Empty… only where it can work, a sign-out-first line on locks a new sign-in clears, a locked refusal worded as such, the teams an activation left waiting, the warning and the team status.
  • Windows matches: the reset offer per lock, the sign-out-first card, the teams an activation left waiting, the warning and the team status. C# bindings regenerated.
  • ADR 0106 records all of it and amends 0051, 0056 and 0065.
  • Tests changed on purpose: a_reset_of_the_wrong_kind_for_its_caller_or_a_second_one_is_not_allowed_on_the_device (was ..._is_bad_statement), a_device_with_no_anchor_proposes_no_reset (now sync.locked), a_kind_3_reset_a_restore_lost_waits_for_a_fresh_step_up_and_says_so (now step_up_required, and the notice goes), the fake model's two reset refusal tests, sign_out_under_a_reset_s_dsk_ends_that_reset (its proposal names kind 2), and the Mac's offeredKindFollowsTheKeyState (a removed Mac no longer offers a reset).

Test plan

  • New device-flow tests (core/crates/sync/tests/device_flows/reset_kinds.rs) and the changed reset tests fail on main's reset code with the fake server's new rule: 31 failures, each kind 2 proposal refused, the kind 3 rotation, lock and step-up assertions failing on their own.
  • team_keys/confirmers.rs: the teams only this account confirms, before a holder, with one, and after another admin.
  • The fake server's a_reset_proposal_is_judged_by_the_row_s_standing_and_its_proof.
  • Mac: ResetKeysModelTests (offers per lock, sign out first, locked refusal words, teams waiting, the warning) and TeamKeysPresentationTests (waiting for another admin).
  • Windows: KeyFlowTests (offers per lock, teams waiting, the warning) and TeamKeysTests; after the merge of main the model build and its 1491 tests pass on macOS, and verify.sh --platform windows bindings passes with the committed bindings.
  • On the merged tree (75eb11d4e5): verify.sh --platform windows build passes (WinUI compiled, 0 warnings); verify.sh test ResetKeysModelTests TeamKeysPresentationTests 36/36 pass; verify.sh l10n passes after the 8 new strings went into the catalog.
  • Before the merge of main: cargo test -p tablepro-sync -p tablepro-sync-testing all pass; cargo clippy -p tablepro-sync -p tablepro-sync-testing -p tablepro-ffi --all-targets -D warnings clean; SwiftLint clean.
  • Codex review, three rounds: four defects found and fixed (a rotation's device certificate dropped with a cancelled kind 2 reset, kind 2 on a left-out device worded as a lock, an old account's waiting teams shown after a switch, the warning missed when the team list loaded late). No security findings.

…rts only where it can, and warns a team's only owner or admin
# Conflicts:
#	core/crates/ffi/src/lib.rs
#	core/crates/sync/src/keys/reset/mod.rs
#	core/docs/decisions/0051-sync-protocol-and-record-rules.md
#	core/docs/decisions/0056-end-to-end-keys-per-account-and-device.md
#	core/docs/decisions/README.md
#	windows/src/TablePro.Interop/Generated/tablepro_ffi.cs
# Conflicts:
#	core/docs/decisions/0056-end-to-end-keys-per-account-and-device.md
#	core/docs/decisions/README.md
@datlechin
datlechin merged commit fccab13 into main Nov 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant