Repository navigation
feat(account): a PC pinned to its account's signed list lets devices in by that list alone - #4607
Conversation
The join line of the account's signed list is amended in place, before anything reads it: its JSON is v, service, account, list, secret, and list is empty while the account has no list. A line in the earlier four-member form is refused. shared/account-list-invite.ts adds what makes an invite a key: the device makes the P-256 pair and gives the account service the public key alone (newInvite), and the machine that joins signs ovis-invite-redeem/1 with the account, its id, its relay key and the challenge id (inviteRedeemBytes, signInviteRedeem, verifyInviteRedeem). Vectors: join/ rewritten with the account and nine added, invite/ new. Nothing outside shared/ imports these files. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The signed list's names (labels, addresses, OS words) go into one `sealed` kind field that the account service stores and cannot read. This adds the pure library for it; nothing outside shared/ imports it. - Member encryption keys: ECDH P-256, non-extractable on a device, a stored PKCS8 key on a PC, spelled like every other key of the list. - Epoch keys, their wrap per member (ephemeral ECDH, HKDF-SHA256, AES-256-GCM), the link from an epoch to the one before and the walk back with a bound. - A commitment to each epoch key that the opening entry carries in clear: a wrap is public-key encryption, so without it the service could hand a new member a key of its own. - `sealed`: AES-256-GCM bound to the entry's list, seq and epoch, with a random nonce. - Opening is total: what does not open is a result, never a throw. 53 vectors, read by the module, by a second implementation in the test and by Chromium with a key that cannot be exported. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The kinds layer opens an epoch with an entry of its own after a removal, so the sealing page and comments no longer say the removal does. A test pins that a key in the list's PKCS8 form reads as a stored encryption key. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The join line of the account's signed list is amended in place, before anything reads it: its JSON is v, service, account, list, secret, and list is empty while the account has no list. A line in the earlier four-member form is refused. shared/account-list-invite.ts adds what makes an invite a key: the device makes the P-256 pair and gives the account service the public key alone (newInvite), and the machine that joins signs ovis-invite-redeem/1 with the account, its id, its relay key and the challenge id (inviteRedeemBytes, signInviteRedeem, verifyInviteRedeem). Vectors: join/ rewritten with the account and nine added, invite/ new. Nothing outside shared/ imports these files. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The commitment is now SHA-256 over its tag, the list id, the epoch and the key. Epoch 0 is committed to in entry 0, before the list has an id: 32 zero bytes stand for it there, and the doc says what that commitment binds. The doc also states the bound of random nonces under one epoch key against the size of a list, and that a key which does not match the commitment is a result of its own (`other_key`) that callers report. Vectors regenerated, five added. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…hey build shared/account-list.ts says what each kind of entry means, on top of the entry format and the signers' rule, which are unchanged. It is ported from the contract's reference implementation and amended for what was decided since. Level 1 is nine kinds: genesis, device, pc, invite, join, remove, carried, card and epoch. A PC that a person added has a signing key and is a full signer; a PC that joined by an invite is no signer. A newcomer signs a card for its encryption key before anybody adds it. Names are sealed, and this layer never opens them: it checks the length and that the epoch beside them is the current one. carried lets the device that starts a list for an account in use name who was in it. The state is plain JSON: devices with power, role, until and encryption key, PCs by relay key, invites, the keys that are out, the epochs. takeEntry, replayList, shownList, readListState, rowsNamed, builders for every kind, and what a caller reads from a state (listView, admitsDevice, holdsPc, wrapKeys). Tests over generated histories hold it to: nobody comes in but by a full signer's entry or the join of an open auto invite, a bound key changes nothing but its own end, and out is out. Vectors: kinds/ 101, card/ 18, names/ 22. Nothing outside shared/ imports the file. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…outes, with a tamper mode The in-memory account service now answers Part D's list routes on the accounts, sessions and PCs its /v1 routes already hold: the genesis, which list, the log in pages, wraps, placing a batch at the head (whole or not at all, compare-and-swap, only entries the shared library takes as counts), the second lock (a device's claim with its card, a PC's post of its keys tied to the directory listing, a join only through the PC route of the PC it names), the mailbox pull's with_list, and the OVIS_LIST_ACCOUNTS-style switch. Tamper hooks per list let a test make the service lie (inject an entry, a wrap of its own, withhold a tail, report a head, fork two readers, cut pages, answer another list, flip a byte, refuse with head_moved forever, drop wraps) to prove a member survives it. Co-Authored-By: Claude Opus <[email protected]>
… service lie Co-Authored-By: Claude Opus <[email protected]>
…y, review fixes After the independent review; no byte of a wrap, a link or a sealed field changes, and no earlier vector. - sealFields fills every plaintext up to a multiple of 256 bytes with a `pad` field and requires the commitment of the epoch: a key that does not give it seals nothing. openSealed drops `pad`. - walkBack checks the key it starts from against its own epoch's commitment and never throws. - Opening reads a caller's bytes only once their length can be the thing's; generated public keys are checked to be keys of the list. - The doc says who seals and when (only under an epoch opened after the last removal), that every attempt makes a new key, what the service still learns, how versions and tags go together, and what counts toward the nonce bound. - Six vectors added (an ephemeral X not below p, filled plaintexts); the second implementation in the test now reads with its own base64url, field form and key prefix. Co-Authored-By: Claude Fable 5.2 <[email protected]>
… off the switch nothing is spent Co-Authored-By: Claude Opus <[email protected]>
…hey build shared/account-list.ts says what each kind of entry means, on top of the entry format and the signers' rule, which are unchanged. It is ported from the contract's reference implementation and amended for what was decided since. Level 1 is nine kinds: genesis, device, pc, invite, join, remove, carried, card and epoch. A PC that a person added has a signing key and is a full signer; a PC that joined by an invite is no signer. A newcomer signs a card for its encryption key before anybody adds it. Names are sealed, and this layer never opens them: it checks the length and that the epoch beside them is the current one. carried lets the device that starts a list for an account in use name who was in it. The state is plain JSON: devices with power, role, until and encryption key, PCs by relay key, invites, the keys that are out, the epochs. takeEntry, replayList, shownList, readListState, rowsNamed, builders for every kind, and what a caller reads from a state (listView, admitsDevice, holdsPc, wrapKeys). Tests over generated histories hold it to: nobody comes in but by a full signer's entry or the join of an open auto invite, a bound key changes nothing but its own end, and out is out. Vectors: kinds/ 101, card/ 18, names/ 22. Nothing outside shared/ imports the file. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…n build does Mirrors the service's /v2 routes where Part D's prose left a choice: the batch is judged entry by entry (holds, counts, then no carried, invites only from a sign-in, a join by its PC, the list's size), then the second lock, the wraps and the head at the write; posts are used up like claims, and a claim is one per key; removals alone spend the first signer's own counter; a genesis takes any wraps for its own epoch and members; a PC's call off the switch spends its proof unless no account is named; a missing sign-in is the unknown route unless every account is named; wraps read gives the latest 256. Co-Authored-By: Claude Opus <[email protected]>
…rvice's tests have them Co-Authored-By: Claude Opus <[email protected]>
…n, and gives no private key After the review of the join line and the invite. No byte of a line or of a redeem message changes. readJoinLine is told the account service its caller uses and whether its caller follows lists, and refuses any other line itself (other_service, needs_lists), before the secret is given to the runtime. What it gives back holds no key that signs what a caller hands it: signRedeem signs the redeem message of the line's own account, and encryptionKey only agrees on a shared secret. signInviteRedeem takes the read line; newInvite moves beside the line's writer. inviteMakeBytes is what a device's key proof signs to make an invite: the proof for adding a PC, with the invite's public key in it. verifyInviteRedeem answers false for what is no redeem at all. One base64url helper, the entry's own, now exported. Vectors: bytes for the four redeem vectors that lacked them, and files for the refusals that only unit tests held (a line too long, a private value out of range, a signature out of range, an invite key off the curve or in a second spelling, the two refusals for the caller, the make proof). Co-Authored-By: Claude Fable 5.2 <[email protected]>
… copy shared/account-list-follower.ts is the pure piece every member runs to get from the copy it saved, and what the account service or another member just handed it, to what it holds as true. The service only stores the log and may withhold, replay or show two members two histories, so nothing here takes its word for who is in. The entry, the signers and the kinds are unchanged: every entry is taken by shownList and replayList. A member is pinned to one list id, by where the id came from (its own genesis, the head of the member that allowed it, the entry that adds a PC, or what a PC let in before the account had a list), and a pin is one-way. takePage takes one page from the service or a peer and gives the new copy, who came and went, a verdict from a closed set and the next request; the result never depends on where pages were cut, and a head the entries do not reach is never caught up. Another history under the footing changes nothing, and is an alarm only when the page proves that a key which was a signer there signed it: the member then keeps its own history, still takes removals, and lets in nobody it did not hold when the alarm rose. Two members compare footings and take the missing entries from each other, so a removal the service withholds from one reaches it from the other, and two members on two histories both get the alarm. What a PC decides (admitsSession, pcOfKey, shownPcs) reads its copy alone. When a member reads is one function of its copy, its clock and what happened. The save is one text with a sum, read back whole or not at all by a replay from entry 0. Tests over generated histories with a service that injects its own entries, withholds, replays, forks, cuts pages anywhere, lies about its head, serves another list and changes single characters. Vectors: save/ 22. Nothing outside shared/ imports the file. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Opus <[email protected]>
… invite or a browser whose time is over After the review of the sealing. sealEpoch(state) is the one place that says whether a writer may seal an entry's names and under which epoch: the current one, and only when it was opened after the last entry that put a key out. Otherwise the writer seals nothing. wrapKeys(state, now) leaves out a device past its until and an invite past its exp, by the caller's clock: an old line or a borrowed browser is given no later key. The clock chooses only whom a key is wrapped to. readNames passes by a field named pad, as it does any field it does not know. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…dPurpose gains list-genesis and list-claim The mirrored challenge route, challenge store and proof check go: a genesis and a claim now ask the fake's own provedKey (POST /v1/pcs/challenge, pcAddSigningBytes) with the list id in the place of the server_id and the claimed key, or nothing, in the place of the listing. Co-Authored-By: Claude Opus <[email protected]>
… a PC cardBinding is SHA-256 over a card's bytes: what the committed comparison of shared/relay-pair-sas.ts is bound to when a PC is added with a number on two screens. Each card vector in form carries it. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…kinds # Conflicts: # docs/account-list.md
…ich signs nothing a caller composes The line that was read gains two closures beside signRedeem: signJoin signs only the body of a join of the line's own key on the line's own list that adds no key and ends none, and signRead only the proof for reading that list with that key. Both judge the bytes they sign. joinEntry is what a PC calls: it hands over its own signing key pair, encryption key and relay key and where the entry stands; the card and the body are made here. So a PC cannot be made to sign a join that somebody else composed. signReadProof takes the line; the key and the list are the line's. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…all or nothing Rulings from the review of the kinds layer, on the follower's side. A member's clock counts for no less than it showed before: each page and each hint is taken at the hour the caller hands over, the copy keeps the latest as seen_at, and admitsSession judges a device's until by memberClock. A clock that was set back lets nobody in past its until. A PC that was in the account before the list follows a list only when it had let in the first signer and every device the list carries in. A carried key is a full signer, so narrowing who is let in one by one kept nothing out: not_held_before is gone, and such a PC lets nobody in. shownDevices and admittedDevices list who is in and who a PC lets in now, so no caller repeats the alarm's hold-back. The save has one more member, seen_at; the vectors are written again (23). Co-Authored-By: Claude Fable 5.2 <[email protected]>
…code with the module Four vectors written once by a Python script (hashlib and the `cryptography` library): a wrap with its commitment, a wrap of epoch 0 with the commitment that has no list id, a link and a filled sealed field. The same script read every other vector and gave its expect. The doc says how they were made, and what `other_key` means from a wrap and from a link. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ims and posts Co-Authored-By: Claude Opus <[email protected]>
…n on disk; a list's removal and a foreign folder at a start Co-Authored-By: Claude Fable 5.2 <[email protected]>
…keys; mutants pinned Co-Authored-By: Claude Fable 5.2 <[email protected]>
…e review Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ws could not be written Co-Authored-By: Claude Fable 5.2 <[email protected]>
…es the take for a list account Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ned PC; sessions under an account id end at the pin Co-Authored-By: Claude Fable 5.2 <[email protected]>
…a sibling folder never takes a pin Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…is owed; one writer discipline for the binding's file; a sibling folder takes no pin; no session by the row of a comparison Co-Authored-By: Claude Fable 5.2 <[email protected]>
…lder pinned a moment ago Co-Authored-By: Claude Fable 5.2 <[email protected]>
… is in one place, inside enter Co-Authored-By: Claude Fable 5.2 <[email protected]>
…no work without the lock; the refresh reads nothing while the file is unchanged Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ons under account ids; one that follows no list closes its account part; an owed removal covers every row of the key Co-Authored-By: Claude Fable 5.2 <[email protected]>
…a read to the service's head lifts the hold; nothing makes keys after a stop; the key lock's wait ends Co-Authored-By: Claude Fable 5.2 <[email protected]>
…one place for a row under an account's id; a second server that learns of a pin; the lock and the refresh; what the mark covers Co-Authored-By: Claude Fable 5.2 <[email protected]>
Reviews that stand in for CodeRabbit on this head (a06e9bf)CodeRabbit reviewed 68f0fee (its 10 threads are answered and resolved) and did not review the two heads after it. This PR changes who can open a PC, so these reviews stand in:
The last read (of 6b0578c) and how each finding was closed in c6262e0
The maintainer's lead session read the first five closures in the diff before merging. No further read was run on c6262e0. Known limit (in
|
|
Merged through CHANGES WHO CAN OPEN A PC. From this PR on, a PC that is pinned to its account's signed list lets a device of the account in only as the list says: a session under the account's id for a key opens with the list's role or not at all, and ends when the list removes the key; only a pairing made at the PC under an id of its own keeps its own role. Nothing pins a PC yet in a released build (the pin's callers ship with P7 and the app's P11/P11b), so no installed PC changes behaviour by this merge. |
… the account's signed list (#4625) ## What A PC that a person added to its account's signed list can let a new device into the list itself, and a device of the list can allow one on such a PC from its own app. This is the PC's half of the Allow (the wire is Part E6 of the list's formats; the app's half is the client lane's). **From the PC itself.** The Allow in the PC's own window, and the digits typed at `ovis approve`, sign the new device's `device` entry with the PC's own list key and place it at the account service. The service places it only while a sign-in of the account has claimed that device's key, so a PC alone, or whoever drives it, lets in nobody. The device is in once the PC's own copy shows the entry, never on the service's answer. **From a device of the list.** On a pinned PC, a device signed in with the key the list holds for it sees the joins into the list that wait there, hears of them on its own socket, and decides one, only when the list holds it to drive with full power (what may add a device to the list may approve its join). The PC signs nothing on such an approval: the member signs the entry, and the PC lets the newcomer in when its copy holds it. **A PC that follows no list answers and tells what main does**, byte for byte: no new member in a waiting pairing, no second event, the same refusal codes. ## The wire - Feature `account-list-allow-1`. `PAIR_REQUEST` gains `list_enc` and `list_card` (both or neither); a PC that did not select the feature ignores them and takes the frame as before, so a PC with no list and an app that sends them still pair. `PAIR_CHALLENGE` gains `list`; `AUTH_OK` gains `list: { id, seq, hash }`, the place of the newcomer's own entry. - The session of a list join carries that receipt and serves nothing else: every call answers 403 `sign_in_required`, and the device signs in with its list key afterwards. The receipt goes by the list's answer, whatever row this PC holds for the key: a row under the account's id with another role, or a pairing under an id of its own (the device then signs in by its list key over that pairing's row). - When no entry lets the device in, the join ends `auth_failed` with a cause in `message`: `list_not_claimed`, `list_service_away`, `list_head_lost`, `list_not_in`, `list_pc_behind`, else `list_refused`. No pairing of the PC's own stands in for the list. - `GET /api/relay/pairings` and `POST /api/relay/pairing` for a device of the list: the joins into the list (`list: true`), a first join too, never a join that brought no card nor one asked under the PC's own add-me screen. A device the list holds to watch, or with bound power, gets 403 `list_cannot_allow`. The right is read from the PC's copy at each call. - The same device hears `remote-pairings` on its own `/ws`, beside the PC's roster. The right is asked again at every telling and when the list changes what it lets in, for a member of the PC's own devices too: a subscriber that lost it (the PC pinned a list that holds its key to watch, say) is told once that nothing waits. - **The member signs only after the new device confirmed.** A waiting join into the list says `confirmed: true` (and the `remote-pairings` event is sent again) once the new device's `PAIR_CONFIRM` arrived, so a device that gives up before that is nobody's member. An approval from afar that comes before it is refused, **409 `not_confirmed`**, and the join waits as it did. From the moment approval and confirm are both in, the PC waits 30 seconds for the member's entry (it asks the service every 3 seconds, takes a page a device hands over at once, and at the end asks once more with a read begun when the 30 seconds are over), outside its read queue. - `GET /api/relay/joins` marks a list join `list`, and `list_behind` on a PC whose Ovis is older than what a member wrote into the list. `ovis approve`, and the terminal that watches after `ovis add`, then say that the approval was received, or that Ovis on this PC needs an update; never "let in", for a first join and a later one alike. - `POST /api/account/introduce` takes `list`, and `GET /api/account/introduction` answers `{ pcs, list? }`, on a PC that follows no list (E6's case 2). - `GET /api/account/list` has `behind`. ## Rules it holds - **One signature per place.** The signed request is kept beside the PC's copy (`account-list-allow.json`, 0600, created and never written over) until the copy is past the head it was signed on. Another Allow at that head (of the same device, or of another: the kept one goes first), one after a restart, and another Ovis on the same state folder send those very bytes and sign nothing else there. An entry that cannot be kept is not sent. - **An answer that does not say whether the entry was placed is no refusal**: a lost answer and a 5xx of a gateway are reconciled against the log before the device is answered, and told as "the service is away", not as a lost place. - **What the PC signs goes by its own clock as it reads now**, held against the list's own time only (`issued_at` is never before the entry it follows). The hour the PC saved lets in and refuses, and signs nothing; the account service's clock is never read. - **A PC that is behind signs nobody in** (a member wrote what this Ovis is too old to read): it says so, and a device of the account can still allow the newcomer. - The PC signs only for a person at the PC: an approval from another browser that drives it, and a member's approval, sign nothing here. - What the PC itself holds against the key, its own place in the account, and whether its copy still lets it sign (no alarm, nothing it cannot read) are asked before each submission and once more **when its proof to the service is made, right before the entry leaves the PC**. - **Another PC of the account** (a vouched join) records the relay key its join proved on its row (`vouched_pc`). On a pinned PC the list answers for it by that key: it is let in to watch while the list holds that PC, at its comparison and at every later sign-in, and is put out when the list removes it. This closes the limit #4607 stated. ## Release order (rule E5) This ships in one release with the next step of this lane (the two session routes a device hands entries over, `POST /api/account/list/head` and `/page`) and with the app that signs in with its list key. Until that step is in, a removal, and a member's new entry, reach a pinned PC through the account service's log only. Nothing here makes a PC pin. ## Reviews, and what this push answers - An independent adversarial review (0 HIGH, 3 MEDIUM, 2 LOW traced; 3 untraced) and a second read of the step. Every traced finding is fixed with a failing test first, and the review's own 16 tests are in the suite (`server/account/list-allow-review.contract.test.ts`). The two untraced ones that reproduce are fixed (a restart and two servers on one folder; a member of the PC's own devices that kept hearing the joins). - CodeRabbit's 13 threads: 12 fixed, 1 answered without a change (the carrier's deadline: a join with a card never waits for the listing's verdict, and `placing` is set in the same turn as `verifying`). ## Choices in this push, for the maintainer - A refusal the account service NAMES (a 4xx with a code, `list_stopped`) forgets the kept request: the service said it placed nothing, and otherwise one refused card would hold back every later Allow at that head. - A kept request that cannot be read refuses every Allow of this PC (`list_refused`) until a person removes the file: what the PC signed is then not known. - While the kept entry is one of a device this PC has since come to hold back, an Allow of another device at that head is refused until the head moves: the kept one may not go out, and signing another there would be a second signature. ## Not covered - `ovis approve` says "approval received" for a list join and does not wait for the read-back before it ends. - The carrier's longer deadline during a placement is tested through the session's `placing` flag only, not the carrier's own timer. - A PC whose own key cannot sign (it joined by an invite) still shows a join as one it can approve in its own window; such a PC does not exist before the next step, which owns that hint. - A row of another PC of the account made before `vouched_pc` was recorded names no PC, and opens nothing on a pinned PC: that PC compares again. - Two small fixes have no test of their own: `Retry-After` waits are capped at 10 s; a placement wait holds no queue. ## Validation - `bun run check fast` (through the shared queue) on the pushed tree: green, 26693 pass, 0 fail. - The integration suite as CI runs it (`bun run test:integration`, in a herdr test session of its own) on the pushed head c450a89: 164 files, 2530 pass, 6 fail, all in two files that reach this PC's own running herdr and are stopped by the tests' guard against it (`server/machine-profile-api.contract.test.ts`; `server/account/step2-upgrade-crash.contract.test.ts`, whose child process answers `live_herdr_refused`). Neither is touched here, and both passed in CI on the previous head. The first push was red in CI's Integration lane for a test of this PR (`server/own-window.contract.test.ts`: the in-process decision of an own-window approval now carries `own: true`); it is fixed here. - Not run: browser regressions (no `src/` change), the Windows and macOS jobs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <[email protected]>
…the list, and a member approves it there (#4635) ## Who gets into an account, and how Before this change, a new device of an account that keeps a signed list could not join through a PC that lets devices in by that list (a pinned PC, #4607, #4625): it came with no card, so the PC made a pairing of its own that opens nothing, and the device was never in the list. A device of the account could not approve such a join from its own app either. After it: - A new device joins a pinned PC **only by an entry of the list**, signed by a member of the list (or by the PC itself, from its own window) **after its own person said the numbers match**. A device that gives up before that is nobody's member. - The device is handed its place in the list by the PC, follows the list from there, and opens the PC with the key the list holds for it. Nothing of the PC's own pairing stands in for the list. - A member signs only for a device the PC says confirmed, and sends nothing more for a device its own copy shows put out meanwhile, or under another member key than the one it began with. - Joins on PCs that follow no list, and accounts with no list, go exactly as before: the same frames, deadlines and words. ## What The app's half of joining an account through a PC that lets devices in by the account's signed list (a pinned PC), for the new device and for the device of the account that approves it. - **The new device brings its card** (`shared/relay-channel.ts` `listCard`, `shell.tsx`, `accountController.ts`). A device that waits to be let into its account's list, its claim of its key standing, offers `account-list-allow-1` with a join of the account. To a PC that selects it, and to no other, its `PAIR_REQUEST` carries `list_enc` and `list_card`. The claim is read for the join: the app reads its list first (which makes the claim again where it is due) and brings the card only where that read shows the claim for the sign-in and the key the join signs with; a view drawn before the page slept decides nothing. - **It stops early at another list.** The PC's `PAIR_CHALLENGE` names the list it follows. Where that is not the list the card is for, the attempt ends before any digits are shown. - **Its person presses "The numbers match".** A member signs the device in on that word, so a join the PC took the card for is never confirmed by itself: also the sheet a PC's own page put up, and a first join's challenge (`approve_on`), keep the number with the press until it is made. Any other join is as before. - **It is handed its place** (`listPlace`). The `AUTH_OK` of a join the PC allowed names the list and the place of the entry that let the device in. The device takes a place only from a PC that took its card, and only in the list the card names, and follows the list from there by its own read of the log. A PC that took the card and names no place is refused (`auth_failed`, `list_refused`) before anything is saved. No pairing is saved: that session serves nothing else, so the app closes it at once and opens the PC anew with the key the list holds (the front page, where the place could not be taken). The place is kept for the account the card was made for alone, also where the sign-in ended or moved meanwhile: a sign-in to that account again takes it up. A join that brought the card waits the comparison's 90 seconds and then up to the PC's own 90 for its entry, and meanwhile sends the relay's own keepalive every minute (the relay closes a socket that sent nothing for two minutes; no PC sees it). - **When no entry lets it in**, the PC ends the join and names the cause, which the app says in words of its own: no sign-in of the account claimed the key, the entry could not be placed in time, a device of the account approved and the PC did not see the entry in time (the words say what the PC saw, never that the list did not take it), Ovis on the PC is older than the list, or anything else. - **A device of the account that approves on such a PC signs only for a device that confirmed** (`join.ts` `approveForAccount`, `AccountApprovalPrompt.tsx`). The PC signs nothing on that approval and lets the device in only by an entry of the list, which the approver signs. The order built: for a join the PC marks `list`, the card holds **Approve** until the PC says that the new device's person pressed **The numbers match** (`confirmed`), and says what to press there; then the approval, and right after it the entry, signed, placed and handed to the PC. A device that gives up before its confirm is nobody's member. Nothing is approved where the approver cannot write its list. Where the list does not take the device after the approval, a card says why ("<device> is not in your account": such a PC made no pairing, so never "added to <PC> only") and **Try again** signs it in. - **Nothing more for a device put out meanwhile** (`join.ts` `holdsStill`). On any PC, before the introduction that names the account's PCs and again before the old `add` is signed, the approver's own copy must still hold the new device as in, in the list and under the member key the approval began with; otherwise nothing more is sent. - **Its relay socket stays open for the whole wait.** A join that brought its card may wait longer than the relay keeps a silent socket (two minutes): it sends the relay's own keepalive every minute meanwhile, which the relay answers itself and no PC ever sees. - **A join with no card on a pinned PC** is that PC's own pairing, which no device is told was confirmed: the approver's card says to approve it on that PC's own screen. - **The member's introduction names the place in both cases** (formats E6); a pinned PC drops it. Strings in en, ko, ja and zh. ## Release order (E5) A new device of a list account can join a pinned PC only with this change, and a device of the account can approve one there only with it. It ships in the same release as the PC's join step (#4630, the change that lets a PC join a list and pin it by a person's act), never after it. ## Reviews (both closed) - **An independent adversarial review** of the app's join step (`review-client-p11b.md`): 0 HIGH, 2 MEDIUM, 2 LOW traced, 3 untraced. All four traced findings are fixed here, each with the test that failed first; its test file is in the suite as `src/lib/relay/review-client-p11b.test.ts` (its four findings and its thirteen guards pass). The untraced three are answered: a join with no card on a pinned PC is shown confirmed to nobody (`listJoin.contract.test.ts` pins it against a real pinned PC), and the other two are by design. The three tests that killed mutants only by hanging now fail within a second (the approval tests' pause moves their clock). - **A Codex read** of the same step (`astra-cl11j.md`): 1 HIGH, 7 MEDIUM, 1 LOW. All fixed here, each with a failing test first, except the LOW (the account controller's `dispose` and the list follower), which #4622 fixed. ## Not in this PR - The page a member hands over is taken by a pinned PC from a device's session only with the PC's join step (#4630). Until then the approver's hand-over is refused there, and the PC reads the entry from the account service within its half minute. Checked locally with #4630's branch merged in: the page is handed (`/api/account/list/head`, then `/api/account/list/page` answers `caught_up` at the new device's entry). - A device approved while its PC was away from the account service is told that the PC did not see its entry in time, and asks again. ## Validation - `bun run check fast` on the pushed head (origin/main 7c9db5e merged in, CodeRabbit's threads answered): 26907 pass, 0 fail. `src/lib/relay/listJoin.contract.test.ts` on it: 5 pass. - On b258554 (before the merges of main, #4633 and the fixes for CodeRabbit's review): - the integration suite as CI runs it (`bun run check integration`, 4 shards, in the CI runner image): 2566 pass, 0 fail, 129 skip in 167 files, `src/lib/relay/listJoin.contract.test.ts` included. That file puts the app's own channel against a real pinned PC session with the account service in memory: a person at the PC allows a new device; a device of the account approves one (nothing until the new device confirmed, then the approval and the entry it signs); a key no sign-in claimed is told so; a card for another list stops before any digits; a join with no card is shown confirmed to nobody. - Browser regressions in the CI runner image, each through `bun run check run`, all passing: `relay-second-device-join-regression`, `relay-join-browser-qa`, `relay-shell-browser-qa`, `my-pcs-ways-regression`, `relay-account-pcs-regression`, `relay-first-link-regression`, `relay-new-pc-press-regression`, `account-list-device-browser-qa`, `usage-account-management-regression`, `add-pc-more-relay-regression`, `relay-e2e-regression`, `offline-typing-relay-regression`, `pc-add-guidance-regression`. None has a pinned PC: they show that a join and an approval on a PC that follows no list go as before. - Screenshots at 390 wide, light, English and Korean, from pages built from the components: the approval card with **Approve** held and the line that says what to press, and with the device confirmed; the new device's sheet waiting for **The numbers match**; its `list_not_in` failure; the approver's card for a device that is not in the account. - Not run locally: `bun run check full`, the Windows and macOS jobs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <[email protected]>
What
A PC can be pinned to its account's signed list. A pinned PC lets its account's devices in only by entries that members signed and that it checked itself. This is the PR that changes who can open a PC, for a PC that is pinned; a PC that is not pinned works as on main.
No screen pins a PC in this PR. A person at the PC names the list at
POST /api/account/list/pin(this PC's own window and CLI alone), and the PC pins it once that list holds an entry for the PC's own key at its own relay key. Never on the account service's word, and one press never pins.The rule
On a pinned PC, a session opened through the account (its id is
accountDeviceId(server_id, key)) is the list's to answer for, and nothing else's. It is let in when the PC's own copy holds that key as a device that is in; as the list's role; until the list'suntil, when a timer of the PC's own closes the open session; and not while an alarm holds the key back or the copy cannot be read. A row of the PC's own devices under that id gives it nothing more, whoever wrote it and whenever: a member'saddfrom before the pin, a join allowed by digits.A pairing made at the PC by a code has an id of its own and is the PC's own business: it keeps the role the PC gave it, the list's
watchanduntildo not reach it, and removing the key from the list does.account-pc.json(binding.list), not in the list's own file: a lost or deletedaccount-list.jsonunpins nothing. While the file holds a pin, or that the list removed the PC, it is written as version 2, which an Ovis from before the list refuses to read. That was run for real against v0.5.9 and against main before this PR: both refuse the file ("unknown version"), block the device registry with Step 2 on and off, and leave the file's bytes as they were. Every write of the file, the other folder's included, is lock, read, reconcile, write: a pin and a removal's receipt on disk are never lost, a binding the file holds cleared never comes back from memory, and the service's word clears no pinned binding. A second server on the folder takes the file in before an unlisting, before a snapshot's rows are committed, and every five seconds.removeddecide no row.account-list-owed.json) names the denial itself (the removed key and the place of its entry; the key whose time passed and that time), is written before the PC acts, is read at a start before the copy and without it, and goes only once the write that makes it unnecessary is on disk. While it stands its keys are refused; a start on a copy that does not reach a removal it names lets nobody of the list in until a read reached that place, or the account service answered one whole read.enterinserver/relay/session.ts), so it holds for every way such a row comes to a session: a sign-in, a pairing confirmed on the PC's screen that reuses the row, a comparison by digits. Sessions open under such an id end withauth_changedwhen the PC pins, also on a second server of the folder that learns of the pin from the file. A server that follows no list (started with Step 2 off) and finds the PC pinned closes its account part and says why.GET /api/account/status(list),GET /api/account/list(reason) andovis status --json(list,problem) carry one sentence a person can act on for each case in which a pinned PC lets nobody in: the copy cannot be read, an alarm, a lost copy with an alarm, stopped at a later level, reading again after a lost copy, started with a change it had not saved, and its other state folder's keys missing.docs/account.md, "The account's signed list on a PC", has the rules and a table of what each word of the account service does on a pinned PC against one that is not.Release order (rule E5)
Nothing in this PR makes a PC pin by itself, and nothing a released app does can: the second condition needs an entry for the PC that a member signed. Anything that makes a PC pin ships in the same release as the app change that signs in with the list's member key. A device signs in to a pinned PC with its member key, not with today's sign-in key, and its
linkis refusedlist_followed: an app from before that change would be shut out of a pinned PC.Known limits
Pushes
9e94612e6: the PR as opened.This push. It closes:
server/account/list-pinned-review.contract.test.tsand pass; 11 of them failed on9e94612e6. H1 (the rule above), M1 (pages), M2 and M3 ("It says so"), M4 (who approves), L2 (this body said every list device waits a hold at the pin: wrong, corrected above), L3 (queued work after a stop), L4 (a copy made for other keys);list_addsaid as an outage;Round 2, this push. It closes a third read of the fix round itself (rulings R2-1 to R2-7), each with a failing test first:
account-pc.json(a removed binding came back from a second server's memory; the other folder's file was written from an old read; a lock that could not be deleted looped);ovis status --jsonasks a closed PC why; the pin's id ispinned_listin both answers.ovis add, because a closed folder takes no add.Round 3, this push. It closes the last read of round 2 (rulings R3-1 to R3-9, all nine in this push), each with a failing test first:
enter, the one place every session passes; the answers file lists every caller with its guard. The screen-confirmed pairing that reuses a row under an account's id opened a session;Validation
bun run check fast(through the shared queue): green on the pushed head.server/account/*.contract.test.ts,server/relay/*.contract.test.ts,server/api.contract.test.ts,server/device-access.contract.test.ts,server/relay-pc-account.contract.test.ts,server/state-merge.test.ts,scripts/plugin-*.contract.test.ts: 75 files, 1404 pass, 0 fail.src/change), the Windows and macOS jobs.🤖 Generated with Claude Code