Chroniton Bridge for VS Code
Open a sandboxed Chroniton Bridge session in a VS Code window with one click: its files, its
terminals (in its sandbox, as that session), its extensions and port forwarding, through
Microsoft's Remote - SSH.
- In the Chroniton Bridge web client, click Open in VS Code on a session (or Open in VS
Code on a session's request:
chronbox code src/main.rs:120 inside the session asks for
one).
- The browser asks to open VS Code; VS Code offers to install this extension the first time.
- The first time per machine, the extension says what connecting means and what it will
change, naming the machine (its name and endpoint id), and asks once. It then enrolls this
computer with the machine by itself: no terminal, no
scp.
- A new window opens on the session's workspace, titled
[SSH: s41.devbox.chronbridge]
(session 41 on the machine devbox). A file opens at its line.
A later click goes straight to the window, past VS Code's own question for an extension's link
("Allow 'Chroniton Bridge' extension to open this URI?"), which VS Code asks every time until
you tick "Do not ask me again for this extension" (the link that installed the extension
passes without it). The connection runs over iroh, directly or through n0's relays, with a
small helper the extension carries (chronbridge-connect) as OpenSSH's ProxyCommand;
nothing goes through an SSH relay.
Requirements
- VS Code, Microsoft's build (Remote - SSH runs on no other), on Linux (x64, arm64), macOS
(Intel, Apple silicon) or Windows (x64).
- Remote - SSH (
ms-vscode-remote.remote-ssh), which VS Code installs with this extension.
- An OpenSSH client (
ssh, ssh-keygen): macOS and most Linux distributions have one; on
Windows, the "OpenSSH Client" optional feature (Settings, System, Optional features) or Git
for Windows. The extension uses the ssh-keygen beside the ssh named by remote.SSH.path,
else the one on PATH.
- A Chroniton Bridge machine whose daemon serves sessions over SSH, a sandboxed session on
it, and a browser with read-write access to it.
What connecting means
The web client's setup panel says this before the first connection to each machine; the
extension's question says it in short (all but GitHub and the licence):
- The sandbox can act on this computer through VS Code. Remote - SSH's own README: "A
compromised remote could use the VS Code Remote connection to execute code on your local
machine." While a window is connected, a process in the sandbox (an agent included) can,
for one, make this computer open links of any scheme without a prompt, and may do more.
Close the window to end it.
- Credentials flow the other way. Extensions run in the sandbox: sign in to GitHub or
Copilot there and the token is where the session can read it. Use a separate VS Code
profile without accounts for these windows, with this extension installed in it too (it
shows the file a link asked for in the window that opens).
- GitHub from the sandbox goes through the session's GitHub proxy, which answers as the
session: Copilot and GitHub extensions in these windows fail or act as the machine's App.
- Loopback is shared by the machine's sessions: VS Code's port auto-forwarding could offer
other sessions' ports. The machine seeds each session's VS Code settings (VS Code's and VS
Code Insiders') to forward only ports a program prints.
- Disk. Each session that opens VS Code downloads VS Code's server into the session (about
700 MB, once per VS Code version).
- Licence. Your VS Code downloads Microsoft's server into the session, as Remote - SSH
always does; Chroniton Bridge neither bundles nor serves it.
How links arrive
Only the web client builds them, from the machine's own data, never from text a session
chose:
vscode://chroniton.chronbridge/open?v=1&host=devbox.chronbridge&session=41&created=…&workspace=/workspace&path=/workspace/&ticket=…
The ticket is fresh for each click and good for two minutes: it lets one key be signed, once,
and nothing else. The extension checks every value (the session and its stamp, the machine's
name, the paths, the ticket's shape) and refuses anything else with a message. It never runs a
command a link chose, never passes a link's text to a shell, and hands the ticket to its helper
on stdin, never on a command line.
The machine's name in a link (devbox) picks the files and the SSH names; the ticket picks the
machine. When the name is enrolled with another machine (another endpoint id), the extension
asks every time, whatever you agreed to before: "devbox is enrolled with another machine.
Point it at this one instead?", naming both. Replace points every devbox window, Recent
entries included, at the new machine. Agree only if that machine's key was rotated or it was
set up again, or you know the new one: a link from anywhere else may be trying to point your
windows at someone else's machine.
What it changes on this computer
~/.ssh/chronbridge/<machine>/: a key of its own (id_ed25519, made with ssh-keygen, no
passphrase, id vscode@<this computer>), the certificate the machine signs for it
(cert.pub), the machine's known_hosts, and config, which the extension rewrites on
every link: as the machine's own stanza, but for the helper (<machine>.chronbridge is
control mode, with a terminal; s*.<machine>.chronbridge a session's). A manual enrollment
found there (a config the extension did not write) is replaced: its config is kept as
config.manual, but its cert.pub and known_hosts are the extension's from then on, so
going back to it means enrolling by hand again.
~/.ssh/chronbridge/pending-opens.json, for a moment: the file a link asked to show, until
the window that opens (or the one VS Code reuses) takes it.
- One line at the top of
~/.ssh/config (or of the file remote.SSH.configFile names), added
once and made if there is no file: Include ~/.ssh/chronbridge/*/config.
- Two user settings:
remote.SSH.remotePlatform gets "*.chronbridge": "linux", and
remote.SSH.connectTimeout is raised to 60 seconds if it was lower (dialing a machine can
take a while).
The certificate is renewed by the next click once it has less than a day left. To undo it all,
delete ~/.ssh/chronbridge/<machine>/, the Include line and the two settings.
After the first click, a terminal reaches sessions too: ssh s41@s41.devbox.chronbridge 'make test' runs a command in session 41, over pipes (sessions give no terminal: a plain ssh s41@s41.devbox.chronbridge gets a shell without a prompt or line editing, and interactive
shells are not supported yet), and Remote - SSH's "Connect to Host…" takes
s41@s41.devbox.chronbridge. ssh devbox.chronbridge is the machine's control mode, with a
terminal, as before.
Troubleshooting
- The extension's log: View, Output, "Chroniton Bridge" (an error's Show Log opens it).
It names each step and never holds a ticket. Remote - SSH's own log ("Remote - SSH" in the
same list) shows the connection.
- "The link has expired": a link works for two minutes. Click Open in VS Code again.
- "The machine did not sign this computer's key": the ticket was used already, or expired
while the question was open; click again. A read-only browser cannot open sessions.
- "There is no ssh-keygen": install the OpenSSH client, or set
remote.SSH.path to the ssh
you use; the extension looks for ssh-keygen beside it.
- The window says the session is not there or has ended: the link was for a session that
ended (a session id can come back for a later session; the link's stamp makes it fail
instead). Open the session from the web client again.
- "devbox is enrolled with another machine": the link's ticket is for another machine than
the one this computer enrolled under that name: two machines with the same short name, a
machine whose key was rotated, or a link that is not what it seems (above). Cancel changes
nothing.
- The window opens but not the file: the window that opened is in a profile without this
extension; install it there too.
| |