Repository navigation
fix(account): relay the account's signed removals to a PC a client brings into the account - #3007
Conversation
…ings into the account A PC now keeps the signed remove records with each account tombstone (one per signer, at most 8) and lists them in GET /api/account/status. A client keeps, verbatim, the ones that verify, are for its account and are signed by its own key or by a device it approved, and enrollPc relays them to a PC it links into the account. A relayed remove whose signer is not a member there yet waits in the PC's account-pending queue and applies once that signer joins. Adds stay out of the enrollment: no client can know it holds every removal of the account, so an add it signed could let a device another member removed into the new PC. Devices of the account join such a PC by approval. Part of #2956
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…t, in signed order Review round (Codex, omo): - A relayed removal never evicts a record that already waits: the PC takes no more once 1000 wait, and drops exact duplicates. - Records a pull is retrying stay on disk when a client relays one meanwhile. - A client relays removals in the order they were signed, so a member's removal comes after the removals that member signed. - keepRemovals reads past its cap, so records that do not check cannot crowd out ones that do. - A relayed removal is written to disk before it counts as waiting. - A client still keeps removals a device signed before this client removed it. - A tombstone file whose records are not a list is refused like any damaged one. - docs/account.md names what relaying does not cover.
Review round (omo + Codex Terra xhigh) and how each finding was resolvedCodeRabbit did not review this PR: it hit its review limit. Fixed in a99de96
Not changed, written in docs/account.md ("Relayed removals are best effort")
None of these admits a device: adds stay out of the enrollment (#2956). |
Re-review at a99de96: CLEAR (omo + Codex Terra xhigh)No HIGH. The remaining findings are unreproduced. None of them is a regression: on main, no other member's removal reaches a new PC at all. They stay open as gaps in a best-effort feature, and no device is admitted by any of them because adds stay out of the enrollment:
The caps and best-effort scope are documented in docs/account.md ("Relayed removals are best effort"). |
|
Local merge gate (owner-approved): required checks green (Fast, Integration, Native Windows); |
Part of #2956
What
A PC that a client links into the account for the first time now also tombstones devices that another member removed, when the client has seen that removal on another PC. The client never signs anything for these removals: it passes them on verbatim.
removeAccountKeystores each verifiedremovewith the tombstone inaccount-tombstones.json, as received. It keeps one per signer, at most 8, so a PC where only a later signer is a member can still apply one. A Revoke on the PC stores none. When two state dirs share a device list, their tombstones merge with every signer's record.GET /api/account/statuslists them asremovals, parsed again on read. A damaged record is dropped.keepRemovalskeeps, verbatim, each listed removal that verifies, is for its account, and is signed by its own key or by a device it approved itself (anaddit signed). At most 256 are kept. A tampered PC cannot make it keep a removal signed by a key the PC made up, and it never signs one.enrollPcrelays them. It sends the client's own removes plus the kept ones through/api/account/recordsand reads every outcome, as before.signer_not_member), the PC puts the removal in its existingaccount-pending.jsonqueue, which retries it on every mailbox pull. Only an account member's session can do this. Once the signer joins, for example by a remote approval, the key is tombstoned. A pairing made on that PC after the removal was signed is left alone (existingissued_atrule).What this does not do: adds stay disabled
This PR does not do the issue's "then enroll the client's own adds" step, so it says "Part of", not "Fixes". A Codex (Terra, xhigh) design review found that no read of the PCs a client can reach proves it holds every removal of the account. A removal can wait in the unread mailbox of a PC that is off, or exist only on PCs the client has no pairing with. An add the client signed earlier could then let a removed device into the new PC.
I reproduced this. Turning adds on in
enrollPcmakes the existing test "does not let back on the new PC a device another member removed" fail: Y admits the removed Mac. A known gap in device admission is not acceptable, so the new PC keeps admitting the account's devices by approval. Each device asks once and compares digits.docs/account.mdexplains why.Tests (real servers)
server/account/account.contract.test.tssrc/lib/account/join.test.tsissued_at).Failing-first: each new test fails with its part of the change reverted. Without the PC-side wait, the relay test fails at
isTombstoned. Without the signer check, the "cannot check" test fails. Withserver/devices.tsfrom main, the status test fails becauseremovalsisundefined.Validation
bun test server/account src/lib/account server/device-access.contract.test.ts: 152 pass, 0 fail (head a99de96)bun run check fast(old-desktop heavy runner, head a99de96): pass (workflow syntax, generated types/themes, typecheck, build, unit tests)