Repository navigation
fix(devices): a revoked device's pairing code ends with it, and ovis add finishes its clean-up or says it could not - #3616
Conversation
…as handed On a PC in no account any driving device may start a pairing code. A device that `ovis add`'s QR code let in could start one, be removed, and the code still paired a second device for up to ten minutes, after the command had printed "Removed." (merge pass review of #3586, reproduced at the store). The pending code now records the paired devices that hold it: the one whose request started it (`POST /api/devices/pair/start`, through the relay or at the PC's own address) and one that was handed it (`POST /api/relay/offer`, `POST /api/relay/code`). `DeviceStore.revoke` ends the code when the revoked device is among them, and tells the listeners, so the typed code bound to it goes too. A code the PC itself started is held by no device and is left alone. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…an-up could not read the devices Follow-up to #3586, from the merge pass review of its head 7a9ce2a. - After an answer that removed a device the run ended on the look taken before the DELETE. A device that linked itself to its own account and brought that account's devices in, or one that paired in between, stayed. The command now looks once more before it ends, in no account or in the account that signed in. - A device list that could not be read as the run ended left `clear` with nothing to remove and nothing said. The read is tried three times inside the deadline. When it still fails, or more devices keep pairing than it looks again for, the command removes what it knew of and says that one may still be paired and where to revoke it. Nothing is said before any code was shown. The other-account branch says the same instead of "run ovis add again to see". - The comments and docs said the account's key signed a member's link. A first member links itself with its own key and names its account, which nothing can check. They now say so, and docs/account.md lists it under what this does not protect against. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
…s on its way gets none Second review of #3616 (Opus and Codex, both CLEAR, same two gaps). - A device revoked while its `POST /api/relay/code` waited on the relay still got a working code: the typed code's mint awaits a relay round trip and then started a code held by a device that was already gone, so no later revoke ended it. The same held during the look-up of who asks, for `pair/start` and `/api/relay/offer`, and for Revoke all with a mint in flight. `startPairing` and `holdPairing` now refuse a device the store no longer has (`DeviceGoneError`), before anything changes: the code pending stays, and the refused start does not count against the window. The routes answer `401 unauthorized`. - `ovis add`, other-account branch: when more devices kept pairing than it looks again for and the PC was out of that account again, it said only "This PC is in no account again". It now says that one may still be paired and where to revoke it, before running the command again. - docs/account.md: a driving device can have the PC itself start a code through loopback from a terminal pane; that code is held by nobody. Co-Authored-By: Claude Fable 5.2 <[email protected]>
# Conflicts: # server/devices.ts
Second review of a70b3ef (Opus: CLEAR, Codex: CLEAR): the two gaps both found, and how each was resolvedFixed in 37a7ea2, head f6bd7fb (main merged in). Each has a test that failed first on a70b3ef.
Tests:
Merging main brought a conflict in Validation
|
Merge passMerged head
Merge pass note (head f6bd7fb, round two). Both reviewers CLEAR. The revoke-during-mint race is closed on every route, Revoke all included; the merge with #3613 kept both the open-access ending of a code and this PR's holder ending; no legitimate start is refused and the new 401 cannot sign a stock client out. Left for one PR after the release:
|
Follow-up to #3586, from the merge pass review of its head 7a9ce2a (note). Security: it is about devices that stay paired, or get paired, after
ovis addsaid they were removed.What
DeviceStore.revokenow ends the pending code when the revoked device holds it, and tells the listeners, so the typed code bound to it goes too.docs/account.mdlists it under "What this does not protect against".How
server/devices.ts: the pending code keepsholders, the paired devices that started it or were handed it.revoke(id)callsendPairing()whenidis among them. This covers Settings' Revoke, an accountremoveand a relay identity reset, which all go throughrevoke.POST /api/devices/pair/startthrough the relay. Two more paths start or hand over a code and are covered the same way, because a device paired at the PC's own address (which the QR code's six digits also admit) can use them:pair/startat the PC's own address: the asking device is recorded (by), apart fromstartedBy, which stays the relay member whose addition the new device is.POST /api/relay/offerandPOST /api/relay/code:dispatch.tspasses the asking device tohandleRelayRequest, and on toRelayService.offerandRelayPairCodes.mint. An offer that carries a code already pending adds the asker to its holders.scripts/plugin-link.ts:clearreturns why it cannot tell that none is left: the list was unreadable, or more devices kept pairing than it looks again for. The sweep and the other-account branch say so. Nothing is said before any code was shown.Decisions for the merge pass
startedBycase.Validation
bun run check faston f6bd7fb (main merged in, with fix(access): a pairing code the open LAN started ends with the gate, and so does a relayed socket that holds the bridge token #3613's conflict inserver/devices.tsresolved): every step ok, 15471 pass, 0 fail.bun test ./server/relay/ ./server/account/ ./server/relay-pc.contract.test.ts ./server/relay-pc.test.ts ./server/open-access.test.ts ./server/device-access.contract.test.ts, 531 pass, 0 fail.server/devices.test.ts"revoking a device that holds a pairing code" (three tests).server/relay/service.contract.test.ts"ends the relay offer's code, and a typed code, with the paired device that asked for it".scripts/plugin-link.test.ts"says that devices may still be paired when this PC's devices cannot be read as the run ends, after trying again", "ends on a look taken after the removal, not the one before it", and the unreadable cases of "says so when the PC stays in the other account".server/devices.test.tsandserver/relay/pair-code.test.ts, the 401 cases in the relay contract test, and themorecase of the other-account branch.bun run check full, the browser regressions (no UI change), a real phone or relay, the Windows and macOS jobs. This PR touchesscripts/plugin*andserver/, so it waits for GitHub's checks.Needs a real review: it changes when a pairing code ends (authentication).
🤖 Generated with Claude Code