Repository navigation
Linked computers: one click links two of your computers through a third - #4011
Merged
Merged
Conversation
A computer linked to two others that are not linked to each other offers to
link them (Settings -> Machines: "Laptop and Mini"), and each of the two offers
the computer it reaches through it ("Mini · through Studio"). One click and the
broker asks one for an ordinary link code and hands it to the other, which runs
the ordinary link with it: the two hold a direct link exactly as a link by hand
makes it. The code lives in the broker's memory for one request; the tokens never
pass through it.
Mark link-through: a list read by a linked computer names its links
(link_through) and its stream says when they move (event: links). Three door
routes only a linked computer's token reaches (link-through-ask, -offer,
-introduce), each refused without the window's mark, an introduction taken once
and only while fresh, a code made and taken only for a computer the broker lists,
and completed only by the computer it was made for. An away computer's link waits
and completes when it is back.
- An introduction's link code is a secret only (no six digits), lives two minutes by its maker's clock, and is bound on the door's own offer record to the computer it is for and the computer that introduced it. - The device such a code makes is provisional: it reaches only health, link-back and unlink; only a link-back from the computer it was made for completes it, however many link-backs failed before or newer offers came; it is revoked unless its link is saved within two minutes, at a restart, and when the introducing computer is unlinked (its unused codes close too). - An address or a way back from the broker is taken only inside a test sandbox, as loopback is; the broker sends none outside one. - An introduction is taken once per broker without comparing clocks, so two computers whose clocks disagree still link; the introductions seen are kept in memory, a bounded number per broker, and never written to disk. - When the broker refuses an ask, the asking computer's row says "Not linked: <its words>" and offers Link again.
- Introductions' link codes get their own list on the door, at most two open per computer introducing them, so they never take the slots of the person's own link codes or an ordinary link's way back. - An ordinary link never saves a link without the device its way back made: it tells the other machine to unlink and fails instead. - An ask the outbox gave up on, or whose link went, says so on its row with the outbox's own words, like a refused one. - Linking through an introduction checks, with this computer's own Tailscale status, that the other computer is a node owned by the same user; when the status cannot be read nothing is refused. Links made by hand are not checked. Skipped in the test sandbox.
Its link-back answered 201 without redeeming the way back it was handed, so the link had no device and is now refused (404 machine_not_linked). It now pairs at the Inbox's door first, as every Inbox's link-back does, and the test checks the saved link carries that device. A new unit test: an ordinary link is saved with its device whatever Tailscale says of the other computer, or when it cannot be read.
…hrough-a-third # Conflicts: # apps/mobile/contract/parity/ledger.json # docs/agent-guides/inbox-machines.md # packages/core/inbox-types.ts # packages/server/inbox-peer-link.ts # packages/server/inbox.ts
…k-computers-through-a-third
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What a person sees
Studio is linked to Laptop and to Mini; Laptop and Mini are not linked to each other (made-up names).
How it works
Mark
link-through. A list read by a linked computer carrieslink_through(the computers it is linked to, and links it is brokering); its stream sendsevent: linkswhen that changes. On the click, Studio asks Mini for a link code for Laptop (POST link-through-offer: a secret only, alive two minutes by Mini's clock, bound on Mini's door to Laptop and to Studio), and hands it to Laptop (POST link-through-introduce), which runs the same link as a pasted code: it redeems the code at Mini's door, checks Mini's health answers with Mini's id, and links back with a code of its own. A click on Laptop isPOST link-through-askto Studio, held in Laptop's outbox while Studio is away. No new cryptography: the tokens are minted by Laptop's and Mini's doors for each other, exactly as in a link by hand.The trust chain
isWindowRequest); an agent's bare call, the CLI or another site is refused.X-Plannotator-Window, believed from a machine's token only); the broker sends it only for a job a click made.health,link-backandunlink(else403 introduction_pending); only a link-back from the computer it was made for completes it (else403 introduction_mismatch, device revoked), whatever came before; it is revoked unless its link is saved within two minutes, at a restart, and when Studio is unlinked from Mini (Studio's unused codes there close too).*.ts.netover https; loopback only in a test sandbox). An address or way back from the broker is taken only in a test sandbox.The code lives in Studio's memory for one request; nothing of it is written on Studio, and the tokens never pass through it.
What is not covered
healthgives; a link stores no key that binds it to the computer the broker linked to.@list still does not say why another computer's agents are missing before the link is made.Tests
Unit:
packages/server/inbox-link-through.test.ts(detection; both online from either side; one away then back; broker away for an ask; older computer; refusal then Link again; refused from a non-linked sender, without the mark, for a computer the broker does not list; a replay; clocks that disagree; the introductions seen bounded and never written; no address from the broker outside a test sandbox; a refused ask on its row; no code on the broker's disk),packages/server/inbox-link-through-pass.test.ts(the real door and coordinator: the provisional device's routes and settling, its binding after a failed link-back and after newer offers, its time, a restart, the broker unlinked; a refused ask in the window's frame),inbox-door-version.test.ts,inbox-peer-link.test.ts. DOM:packages/inbox/linkThroughRows.test.tsx. E2E (CI only):tests/e2e/inbox-link-through.spec.ts, three compiled Inboxes; proof screenshots under.local/proof/link-through/.