Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
…e mailbox Review fixes (omo and Codex on #2843): - a revoke on the PC leaves a tombstone, so a replayed add cannot undo it; - a code started through the relay, or a remote approval, never clears or bypasses a tombstone, and an unreadable tombstone file fails closed; - a stop between two writes is finished on start, told apart by time; until then a stale row neither signs in, signs nor approves; - a remove signed before the PC paired the key again leaves it be; - a link must start from the key its session signed in with, and never takes a key another row holds; - the mailbox collects nothing while removals could not be applied, sends a last ack at its page limit, and a bad service address is its error; - tombstones merge across sibling state dirs; Portal and open LAN windows are refused on /api/account/*.
0c322cd to
10ac0a6
Compare
Review in place of CodeRabbitCodeRabbit skips this PR (its base is not the default branch), so two review agents stand in (AGENTS.md: a PR touching authentication). Both reviewed 0c322cd: the omo code review answered BLOCK, and the Codex review of the authorization rules found the issues below. Every one is resolved in 10ac0a6, each with a test that fails without its fix.
Validation at 10ac0a6: |
Second review roundThe omo code review of 10ac0a6 (with its own Codex run) answered BLOCK. HIGH, reproduced, fixed in b2e7151. The rule that a pairing made on this PC outlasts an older The rest stay open as follow-ups, per this lane's rule of one extra fix round:
Validation at b2e7151: |
Third review round (final for this lane)The omo review of b2e7151 answered BLOCK on one reproduced HIGH. HIGH, reproduced, fixed in d7811e6. A row paired with a code that an account member started through the relay had no MEDIUM, documented. The order of a These MEDIUM and LOW findings stay open as follow-ups (the first three were listed in the previous comment):
Validation at d7811e6: |
…ough a broken file or a merge Final review fixes on #2843: - an add whose key is not a P-256 point is refused: stored, it left a devices.json no store could read, locking out every device; - a revoke while account-tombstones.json cannot be read writes its tombstone to a pending file, folded back in once the file is fixed; - merging two state dirs keeps the account key of a row linked in either; - a member's relay code lets nobody in once the member is revoked.
Fourth review roundThe omo review of d7811e6 (with its Codex run) answered BLOCK. Fixed in ae93279, each with a test that fails without its fix:
The open MEDIUMs listed in the earlier comments stay follow-ups: a sibling dir's unreadable tombstone file, and Validation at ae93279: |
…t the mailbox
The PC side of linking devices through an account (docs/account.md):
- records: a drive member's add inserts a member row (added_by), its
remove writes a tombstone and revokes the key; no account record clears
a tombstone, a pairing on this PC does. A member removed signs nothing.
- /api/account/{status,link,records,enroll}: drive only, through the
relay too; link proves the row's key over its own session and gives
the PC its first member; enroll only from a member, adds only.
- mailbox: pulls this PC's records with a server proof for the account
role (the relay never accepts it), acks every processed record.
- the account feature in WELCOME; reset relay identity leaves the account.
…e mailbox Review fixes (omo and Codex on #2843): - a revoke on the PC leaves a tombstone, so a replayed add cannot undo it; - a code started through the relay, or a remote approval, never clears or bypasses a tombstone, and an unreadable tombstone file fails closed; - a stop between two writes is finished on start, told apart by time; until then a stale row neither signs in, signs nor approves; - a remove signed before the PC paired the key again leaves it be; - a link must start from the key its session signed in with, and never takes a key another row holds; - the mailbox collects nothing while removals could not be applied, sends a last ack at its page limit, and a bad service address is its error; - tombstones merge across sibling state dirs; Portal and open LAN windows are refused on /api/account/*.
The omo re-review reproduced a PC that was off taking a member's add and remove together and keeping the device: the rule that a newer local pairing wins also spared rows the add itself had just made. Only rows without added_by (paired on this PC) are spared now.
…'s addition The omo review reproduced a row paired with a code an account member started through the relay outlasting an older remove, as if it had been paired on this PC. Such a row now records the member as added_by, so a remove takes it; only pairings made on this PC are spared.
…ough a broken file or a merge Final review fixes on #2843: - an add whose key is not a P-256 point is refused: stored, it left a devices.json no store could read, locking out every device; - a revoke while account-tombstones.json cannot be read writes its tombstone to a pending file, folded back in once the file is fixed; - merging two state dirs keeps the account key of a row linked in either; - a member's relay code lets nobody in once the member is revoked.
… no account The omo review reproduced a regression from the previous round: a code a relay device started on a PC in no account recorded its starter and then failed the member check. A code now records whether it was started through the relay (never clearing or bypassing a tombstone) apart from the member that started it, if any. A member's code is checked on the cookie path too, and the sibling-dir merge reads pending tombstones.
…e account's PCs
An add record's device gets id hex(SHA-256('ovis-account-device/1' ||
server_id || key))[0:16] (accountDeviceId), so the client signs in with
it without asking. A drive member may introduce the account's PCs it
verified to a device a member added (POST /api/account/introduce); the
device reads them over its own session (GET /api/account/introduction).
Kept in memory for 10 minutes; each PC still admits by its own list.
68bf8cc to
e83842f
Compare
ae93279 to
eff9192
Compare
Fifth round, and the contract additionsHIGH, reproduced by the omo review of ae93279, fixed in 0f583ac. On a PC in no account, a code a relay device started recorded that device as its starter, then failed the member check, so the new device could not pair. That broke the existing "connect another device" flow on every PC. A code now records two things apart: whether it was started through the relay (then it never clears or bypasses a tombstone), and which account member started it, if any (that member becomes Contract additions agreed with the client lane, in eff9192 (spec in #2834):
Each rule has a test that fails when the rule is removed. Validation at eff9192: |
… members' accounts to drivers Codex review of #2843: a device admitted with a code or by comparing digits never signed with its key, so its session may not link, introduce or read an introduction; a session from a row's older key acts as no member; a code started through the relay always records its starter as added_by, so an older remove still takes the device. As agreed with the client lane, GET /api/devices adds account, account_key and added_by to members' rows for callers with drive access only.
# Conflicts: # docs/account.md # server/devices.ts # server/relay/service.ts
… a fresh admission of that key The lead's rule for design 5.3: a comparison with pair-intent-account outside the owner's pairing window is taken only on a PC in an account with a member to approve it, for a key the account's mailbox (pulled with the PC's server proof) has an admission of at most 10 minutes for, at most 5 a minute. It is shown to account members only and needs their pick of the digits; anything else is refused before any prompt and not counted. The mailbox reads an identity already on disk too.
Deploying ovis with
|
| Latest commit: |
1560397
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://747f796e.ovis.pages.dev |
| Branch Preview URL: | https://feat-account-pc.ovis.pages.dev |
…p former keys out of member actions Codex's final review of #2843: cached admissions are kept per account, PC identity and key, so none carries over after the PC changes account or identity; a session from a row's former key cannot start a member's code or hear members-only prompts; refused join requests do not spend the PC's five joins a minute, and a miss pulls the mailbox at most every ten seconds; the comparison's deadline is extended before the pull; a watching device reads its own introduction; a client may require the features the PC selects.
Sixth and seventh rounds, main, and the account-join rule
Joining through the account outside the owner's pairing window (design 5.3): a comparison with
It is shown to account members only (
Also agreed with the client lane: Codex review of eff9192, HIGHs reproduced or traced and fixed in d58dd0f:
Codex review of 3b9b63f, fixed in 2a318b5:
Each fix has a test that fails without it. Left as follow-ups:
Validation at 2a318b5: |
… merge, fail closed on a sibling's tombstones omo review of 2a318b5: a remove refused because its signer's own add came later in the same pull is tried again once the pull is read; of two copies of a linked row the later link (linked_at) wins; a sibling dir's unreadable tombstone file blocks account records on the active store; a row a member added goes with its key's tombstone on start whatever its time.
Eighth roundThe omo review of 2a318b5 (with its Codex run) answered BLOCK. All four findings are fixed in 612d9d4, each with a test that fails without its fix:
Validation at 612d9d4: |
…their page is acknowledged omo review of 612d9d4: the single retry ran after the page's ack was sent, so a failed next request lost the remove, and a chain of adds two deep still lost it. Records refused for a missing signer are now retried after each page, before the next request acknowledges it, until a pass applies nothing more.
Ninth roundThe omo review of 612d9d4 answered BLOCK on two reproduced HIGHs in the previous round's retry of early removes. Both are fixed in 787ebd4:
Records refused for a missing signer are now retried after each page, before the next request acknowledges it, until a pass applies nothing more. New test: "a remove at the end of a chain of adds read in reverse in one pull still applies". It fails with a single pass. Also merged in: the contract's Left as follow-ups:
Validation at 787ebd4: |
As agreed with the client lane: a machines event device-removed
{ event_id, device_id, label, removed_at, by } goes to streams with drive
access whenever a device loses its access: a revoke on the PC (by 'pc'),
through the app (by that device), or an account remove (by its signer).
… restarts omo review of 787ebd4: a remove whose signer's own add came in a later pull was refused and acknowledged, so the removed device stayed. Records refused only for a missing signer now wait in account-pending.json and are tried on every pull until they apply (at most 1000). A failing identity read is the mailbox's error, not a throw.
Tenth round, and the device-removed eventHIGH, reproduced by the omo review of 787ebd4, fixed in 803b91e. A Agreed with the client lane, in 955ff07: a machines event Left as follow-ups (LOW):
Validation at 803b91e: |
…ledged omo review of 803b91e: waiting removes were written only when a pull finished, so a stop after the service took the acknowledgement lost them, and a failure mid-retry dropped the ones taken out. They are now saved after each page's retry, before the next request acknowledges it, and on failure; a record leaves the list only once its outcome is known.
…UNT_SERVICE_URL names As agreed with the client lane: when OVIS_ACCOUNT_SERVICE_URL is an https origin, the PC's own pages add exactly that origin to connect-src; nothing when it is unset or not https.
Eleventh round, and the PC pages' account serviceHIGH, reproduced by the omo review of 803b91e, fixed in 1b36924. Removes waiting on their signer were written to disk only when a pull finished. A stop after the service took the page's acknowledgement lost them, and a failure partway through a retry dropped the records taken out (the review's MEDIUM). They are now saved after each page's retry, before the next request acknowledges that page, and again on failure. A record leaves the list only once its outcome is known. The test checks that the remove is on disk at the moment the acknowledgement leaves; it fails without the save. Agreed with the client lane, in 433333b: when Validation at 433333b: |
…events WebSocket The default client takes machine events over the WebSocket, which only subscribed local approvers to relay-pairings, so a drive account member connected through the relay never saw a join waiting for its pick of the digits. It now subscribes such members to remote-pairings as the SSE path does (the row's current key required); watching devices still hear none. Closes #2862
Remote pairings over the machine-events WebSocket (#2862)The default client takes machine events over the WebSocket. That path subscribed only local approvers to Fixed in a940639: the WebSocket path now subscribes such members to Tests in
Closes #2862. Validation at a940639: |
# Conflicts: # server/relay/session.ts
|
Landed as part of #2867 (the whole account stack was merged there in one squash). |
Summary
The PC side of linking devices through an account, as specified in
docs/account.md(#2834), on top of the one admission rule (#2840). AUTH and the mux frames are unchanged;devices.jsonstays the only authority.Stacked on #2840 → #2834 → #2696.
server/account/records.ts,server/devices.ts): anaddsigned by a drive member of this PC's account inserts a member row withadded_byand is announced like any enrollment. Aremovewrites a tombstone first, then revokes every row with that key (its relay sessions end withauth_revoked). No account record clears a tombstone, so a replayedaddis refused (tombstoned); a pairing made on this PC clears it, and a remote approval of a tombstoned key is refused. A member that was removed signs nothing more. Records of another account answeraccount_mismatch; batches answer every outcome and never fail as a whole. Tombstones live inaccount-tombstones.jsonbesidedevices.json, so the legacy state-dir merge, which rewritesdevices.jsonwith its known fields, cannot drop them.server/account/routes.ts):/api/account/status,/link,/records,/enroll. Drive access only, directly or through the relay, with the app's mutation guard. Alinkcomes over the linked row's own relay session, names that session'sserver_idand that row, and swaps the row's key to the account key in one write. This is also how the PC gets its first member, and how a row left behind by a PC that was off is linked later;status.unlinkedlists such rows.enrollis for a member of that account and carriesaddrecords only.server/account/mailbox.ts): while the PC has members and a relay identity, it pulls its records from the account service every five minutes. It authenticates with a server proof for the newaccountrole, and acknowledges every processed record, refused ones included. The service URL isOVIS_ACCOUNT_SERVICE_URL(https, or http on loopback), defaulting tohttps://account.ovis.sh.accountis selected inWELCOMEfor a client that offers it. The relay peer context now carries the session'sserver_id.Validation
server/account/account.contract.test.ts(11 tests, realRelaySessions with Noise,mkdtempSyncstate,port: 0, the in-memory account service from feat(account): contract for linking devices through an account #2834) covers:addapplied, with stranger, foreign-account, forged and malformed records refused;removethat cuts the device off, a replayedaddrefused, and a pairing on the PC letting the key back;accountfeature;relay/server-proof.test.ts: the local relay refuses a control socket answered with anaccount-role proof (the test fails if the MAC stops covering the role).bun run check fastat 0c322cd: workflow syntax, generated files, typecheck, build and unit tests (10973 pass, 0 fail) all ok.Closes #2862