Skip to content

fix(core-sync): a restored store sends no synced password sealed for the restored destination - #4832

Merged
datlechin merged 3 commits into
mainfrom
fix/core-sync-restore-seals-only-read-destination
Dec 2, 2026
Merged

datlechin merged 3 commits into
mainfrom
fix/core-sync-restore-seals-only-read-destination

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

Closes the residual left after #4820 (core ADR 0114, A pulled destination does not take a stored secret; A store in refill).

  • A library restored from a backup, a records store that refuses the refill's copy, and a secret store that still holds the password synced for the newer destination: the envelope adapter read the restored destination as a move the person made here, so the newer destination's password went up sealed for the restored one.
  • EnvelopeAdapter::records now seals a secret only for the destination it was read for. While the engine holds a parent as RefusedInRefill:
    • only a secret that provably differs from its envelope's goes up, sealed for where the record points, as a password changed here does today;
    • the secret that synced stays as the server holds it, not sealed again after a rotation, as 0114 has it for a held record;
    • an envelope that is gone or does not open now sends nothing, since nothing tells where its secret was read for.
  • The per-secret part of records moved into listing to stay under clippy's line limit, with no other change.
  • No change to the Mac or Windows hosts, the FFI API or ADR 0114, whose rule already says a stored secret moves to another destination only when the person changed it or the destination on this device.

Test plan

  • tests/engine/destinations.rs, each failing on main and passing here:
    • a_restored_store_that_refuses_the_synced_copy_seals_no_password_for_the_restored_destination, end to end through the engine and the fake server: on main the server's envelope holds the new password sealed for db.old. Once the store takes the synced copy, the record points at db.new with its password.
    • a_restored_store_s_synced_password_is_not_sealed_again_after_a_rotation
    • a_restored_store_whose_envelope_does_not_open_now_sends_nothing_for_the_restored_destination
    • a_restored_store_whose_envelope_a_snapshot_dropped_sends_nothing_for_the_restored_destination
  • a_password_changed_here_on_a_restored_store_that_refuses_the_synced_copy_goes_up_for_where_it_points, end to end, pins the changed-password flow; it passes on main and here.
  • verify.sh --platform windows --jobs 4 core for tablepro-sync, tablepro-sync-testing, tablepro-sync-host and tablepro-ffi: PASS, 1309, 105, 16 and 553 cases.
  • cargo clippy --locked --all-targets -D warnings for the same four crates: clean.
  • Codex review and security pass: round 1 found that a base that does not open fell back to the restored destination, and round 2 that every fallback destination guessed. Both are fixed by sending nothing when it is not known where the secret was read for. The last review found nothing.

Left open

  • An envelope base that stopped opening before the restore, after a re-seal that never went up, keeps a restored record held: the envelope waits and parent_landing refuses the landing while it cannot compare the stored secret. Nothing leaks. The cause is the keys moving an envelope's floor when it is sealed, not when the copy goes up.
  • A password changed and not sent before the library was restored still goes up for where the restored copy points, as any password changed here does.
  • With SSH or credential profiles turned off and passwords on, a restored store owes its refill until the kind is on, so no RefusedInRefill row marks its copies.

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