Networking
How Bridge machines reach the server over their own tailnet, what the relays can and cannot see, every port in use, and what is never exposed.
Every Bridge runs its own private network, a tailnet with its own control plane, and every machine reaches the server over it. Nothing listens on a public interface: the server and every agent dial out, and the only listeners are on loopback.
Source: docs/tailnet-threat-model.md in the Bridge repository is the full
security review; this page is the operator's summary of it.
The pieces
| component | runs on | trusted with | if compromised |
|---|---|---|---|
| Bridge server | the host | LLM keys, every chat, invite issuance | everything |
| Sidecar | the host | the control plane's admin key, relay registration | can mint network access; cannot read chats |
| Headscale | the host | node identity, ACL policy | can admit rogue nodes; cannot decrypt peer traffic |
Relays (bridgeproxy.net, headfwd.net) | the internet | nothing | denial of service only |
Tailnet client (bridge-tailnet) | each machine | the pinned server identity | that machine's own access |
The control plane's admin key lives in the sidecar, not the server, so a bug in a web request handler cannot mint network credentials.
Joining: verify, then speak
An invite looks like this:
inv_v2_<fingerprint>_<preauth key>
- The fingerprint is the first 128 bits of the SHA-256 of the control plane's public key. It is public; it reaches the user out of band, inside the invite, never through a relay.
- The preauth key is a single-use credential, valid 24 hours, minted with
the ACL tag
tag:user-<name>. The server chooses the tag, so a machine cannot claim to be someone else.
On joining, the client:
- Fetches the control plane's public key through a relay.
- Checks it hashes to the fingerprint from the invite.
- Only then sends the preauth key.
Reversing 2 and 3 would let a rogue relay harvest preauth keys, so the client refuses to start, and the Linux installer refuses to continue, until step 2 passes. After first contact the key is pinned: a later connection must match the pin even when the fingerprint matches.
What the relays see
Relays route by fingerprint subdomain (<fingerprint>.bridgeproxy.net) and
carry Tailscale's encrypted control protocol. A relay cannot read it, alter it,
or impersonate the control plane, because the client checks the key it is
served. It can drop traffic, which is why there are two, on different
providers.
Peer traffic is WireGuard between the machines. When two machines cannot reach each other directly, Tailscale's public DERP servers forward it, still encrypted end to end.
Identity without passwords
The server learns who is connecting from the tailnet itself. Each machine's
node carries a tag:user-<name>, and the server asks its own tailnet daemon
which node a connection came from. A browser, the desktop app and the Linux
installer all sign in this way, which is why there is no login form and why a
machine joined with your invite is owned by you.
HTTP trust boundaries
Userspace tailnet TCP arrives on loopback. That does not make a peer a local administrator or a trusted reverse proxy. Bridge resolves direct callers from their socket IP/source port using WhoIs/ProxyMapper. Only the development Vite proxy may forward that pair, authenticated with a private per-boot capability. The server and Vite discover it locally; no browser receives it.
The API rejects unapproved browser Origins and Host names, including raw WebSocket upgrades and production's extra listeners. CORS reflects only an accepted exact origin, never a wildcard. The tray validates its incoming local Host/Origin before rewriting Host upstream. Native clients without Origin are still supported; origin checks never supply user identity.
One kind of cross-site request is admitted by both the API and the tray: a
top-level page load (GET/HEAD with Sec-Fetch-Mode: navigate and
Sec-Fetch-Dest: document) of a path outside /api, /git, /__bridge and
the WebSocket paths. That is how Stripe Checkout and the accounts site send a
tab back to /account-return. The other site cannot read that response, and
everything the page fetches afterwards is same-origin and fully checked.
Custom aliases/frontend origins are owner/admin-managed through GET/PUT
/api/settings/browser-security, with a Bearer session and JSON
{"hosts":["bridge.example.com"],"origins":["https://frontend.example.com"]}.
Host entries are exact DNS names without ports; origins include scheme/port,
with no path. Use a supported address to configure access before adopting the
alias. In source development Vite also admits exact names from WEB_HOST.
Upgrading this protection requires server, sidecar and tailnet-client/tray updates. On a checkout, relaunch the supervisor after chats finish; changing only the child process does not reload the supervisor's new authentication.
Compression
Bridge is usually reached over a tailnet tunnel, so the server compresses what it sends:
- The web app's files are compressed once, when the client is built. Each
asset has a
.brand a.gzcopy beside it, and the server picks one from the request'sAccept-Encoding. Hashed files under/assets/are cached asimmutablefor a year;index.htmlisno-cache. Adist/built before this change has no compressed copies and is served uncompressed. - API responses (JSON and text over 1 KB) are compressed per request: brotli
quality 4 when the client offers
br, otherwise gzip level 6. Event streams (text/event-stream), file downloads and git traffic are not compressed. - WebSockets negotiate
permessage-deflate, and frames over 1 KB are compressed. A chat's initial sync is the large one: about a sixth of its raw size on the wire.
Proxies in front of Bridge must pass Content-Encoding through unchanged, and
must not strip Sec-WebSocket-Extensions. A proxy that recompresses will still
work, but it costs CPU twice.
Ports
All loopback. "Client" is every machine with the agent; "host" is the machine running the server.
| port | where | what |
|---|---|---|
2600 | Linux client | bridge-tailnet tunnel: the server, as seen from this machine |
2620 | Linux client | bridge-tailnet control shim, which tailscaled logs in through |
2640 | Linux client | the tailnet's SOCKS5 proxy, which the agent dials the server through |
2601-2619, 2621-2639, 2641-2659 | Linux client | the same three for each further Bridge the machine is on, the next free port in each block (see More than one Bridge) |
2660 | host | Headscale (control plane) |
2661 | host | sidecar (invites; needs a bearer token as well as loopback) |
2662 | host | the server node's SOCKS5 proxy |
2687 | host | the Bridge server: web app, API, agent hub |
5173 | host | the web app's second port, when the server binds it |
2800-2899 | host (desktop app) | further Bridges on a Mac or PC that hosts more than one: ten ports each, starting at 2800 + 10(n-1) for the nth extra Bridge. Control plane at +0/+1/+2, server at +7 (2807, 2817, …). A dev install uses 2900-2999. |
A machine hosting several Bridges gives each one its own ports, because every
server node forwards tailnet traffic to the same port number on loopback. Each
Bridge's access policy admits only its own server ports
(tag:bridge-server:5173,2687 for the first, tag:bridge-server:2807 for the
second, and so on), so a member of one team cannot reach another team's server
on the same machine. Clients find the right port themselves by trying each
candidate.
The desktop apps use the same scheme with their own numbers per Bridge they join. A machine joined to several Bridges also has their tunnels call each other, over loopback on the tunnel ports above, so the Bridge switcher under the logo can show every Bridge's unread counts. No new port is opened, and each tunnel still talks only to its own server. Turning off Show My Other Bridges in Bridge in the menu-bar app stops the list being shown.
The agent itself listens on no TCP port at all; its local API is a Unix
socket (/var/lib/bridge/agent.sock on Linux installs), mode 0600, or a
per-user named pipe on Windows. Bridge for Chrome reaches it the same way: Chrome
starts bridge-agent as a native messaging host (com.bridgedesktop.agent,
registered per user by the agent at startup; set BRIDGE_NATIVE_HOST=off to
skip), and that process talks to the running agent over this socket. No port is
opened for it.
Outbound checks to GitHub
To tell a machine's owner which GitHub account the machine can push as (the
Git sign-in notice on the Code tab and on My machines > Access), the agent
runs gh auth status and ssh -T git@github.com:
- When: when the server asks, which is on connect if the last check is over a day old, once a day, or on Check again.
- How: ssh runs with
BatchMode=yes,StrictHostKeyChecking=yesand a 5-second connect timeout. It never prompts and never writesknown_hosts. A machine that has never trusted GitHub's host key reports "not checked" instead. - What is sent: only account names, key file names, helper names, token-variable names and remotes with any password stripped. Never a token, a password or a key.
- Blocked port 22: if outbound port 22 is blocked, the SSH half simply times out.
Outbound model requests for a personal subscription
When a person links their own Claude, ChatGPT or Google Antigravity plan on a computer, the agent on that computer makes that person's model requests:
- Hosts: HTTPS to
api.anthropic.com(Claude),chatgpt.com(ChatGPT Codex) ordaily-cloudcode-pa.googleapis.com(Antigravity), plus each vendor's token endpoint to refresh the login. Each kind may reach only its own host; the agent refuses any other. - Credentials: the login stays on the computer: Claude Code's and the Codex CLI's own files (or the macOS keychain), or a 0600 file under Bridge's data folder for Antigravity. The server sends requests without a credential and never receives one.
- Antigravity sign-in: a one-shot listener on
127.0.0.1:51121while the Google sign-in is open, closed after the redirect or 10 minutes.
What is never exposed
- No port on a host interface. No service binds
0.0.0.0, and no port forwarding or firewall opening is ever needed. - The agent dials out. It connects to the server over the tailnet; the server never connects to the agent.
- No routes, no DNS changes. The tailnet runs in userspace mode: no TUN
device and no
100.64.0.0/10route, so the machine's own networking is untouched and the tailnet is reachable only through its SOCKS5 proxy.
Some loopback listeners are reachable from the tailnet, because userspace
tailscaled delivers inbound tailnet connections to loopback. That is how a
shared dev server is reached. Such a listener cannot tell which peer is calling
(the source always reads 127.0.0.1), so each one authorizes with a capability
or a check with the server, never by address.
WebRTC call audio and video
bridge-tailnet also runs a small TURN
relay for its own browser, so a call can use the browser's WebRTC engine (Opus
error correction, an adaptive jitter buffer) across the tailnet. It opens two
kinds of loopback listener, both on ephemeral ports (no fixed number):
| listener | what | who may use it |
|---|---|---|
| TURN, UDP and TCP on one port | the browser's only ICE server | anyone with a credential from the voice socket, which mints a 12-hour one per call |
| one UDP port per call leg | where the other tray's relayed packets arrive | a datagram is delivered to the browser only from a peer address the browser itself granted, and must then pass the call's DTLS-SRTP |
The relay never decrypts anything: encryption runs between the two browsers, and the trays only forward sealed packets. Each forwarded packet carries a small header naming the sending relay, because netstack hides the real source. A browser can only aim the relay at tailnet addresses.
Direct connections (on by default)
With Settings > Server, Voice · Direct connections in calls on, a WebRTC pair may also connect computer to computer without the tailnet:
- The browser adds a public STUN server to its ICE servers (by default
stun:stun.cloudflare.com:3478; an owner or admin can list up to three others) and lets ICE try host and server-reflexive candidates before the tray relay. Where the two computers can reach each other, audio and video go over plain UDP between them; where they can't, the tray relay above carries the call as before. - Ports: outbound UDP to the STUN server (3478 by default), and UDP between the two browsers on ports the browser picks. Nothing listens on a fixed port and no server of Bridge's is involved.
- What the other side sees: the people in a call can see each other's public IP address, and once the microphone is allowed Chrome also offers LAN addresses. The STUN provider sees that the machine asked for its address.
- Encryption is unchanged: DTLS-SRTP end to end between the browsers, keyed through Bridge's own signalling.
- Without the tray: a browser that is not opened from the tray gets WebRTC through STUN alone, with other browsers that can reach it. A pair with no route in common (a tray-only end and a trayless one, or the iPhone app, which is still relay-only) stays on Bridge's own audio path.
Off, the browser is told to use relay candidates only, so it never offers a LAN address to the other side and every WebRTC packet goes through the trays. A change applies from each person's next join.
Call video (on by default; switched off for a whole server under Settings > Server, Voice · Video in calls) uses the same relay and the same listeners; nothing new is opened.
- Encryption: video packets are sealed end to end like the audio.
- Bandwidth: every camera is sent separately to each other person on video (there is no server forwarding one copy), so upload grows with the number of people. Each sender caps itself at about 1.2 Mbps per receiver for one or two receivers, 600 kbps for three or four, and 300 kbps beyond. Audio is marked higher priority than video, so under congestion the picture degrades first.
- Screen sharing: a shared screen is one more stream per receiver on the same connections. It is capped at about 2.5 Mbps for one receiver, 1.5 Mbps for two or three, and 800 kbps beyond, at 15 frames per second or less, and is never scaled down. Its priority is between audio and the cameras.
- CPU: the tray's userspace tailscaled forwards these packets too, so its CPU use rises with the number of video streams.
The iPhone app runs the same relay inside the app, on its in-process tailnet node, for its own WebRTC engine. Its TURN listener is on the phone's loopback and its relayed packets travel over the app's tailnet sockets, so nothing is opened on the phone's network interfaces either.
Coexisting with a system Tailscale
Bridge's tailnet is designed to sit beside a corporate Tailscale on the same machine:
- Userspace networking, so the two daemons never compete for interfaces or routes.
--port=0, so Bridge's daemon picks a free WireGuard port instead of colliding with the system daemon's41641.- A separate control socket, so
tailscalecommands reach the right daemon.
Addresses come from 100.100.0.0/16, inside Tailscale's range. A collision
with a system tailnet address is possible but harmless: each daemon resolves
only its own addresses.
Cloud VMs
A cloud workspace (DigitalOcean or Linode, created from Add a workspace) joins the tailnet like any Linux install, with three additions:
- The provider API key is held on the Bridge server, encrypted with a key
stored outside the database. It is only ever sent to
api.digitalocean.comorapi.linode.com, never to Bridge's hosted services. Server administrators can reach it. - The VM has no public inbound ports: a provider firewall and the guest's own rules drop everything inbound except replies, DHCP and IPv6 control traffic.
- Before binding a reconnect credential, the server asks the tailnet sidecar
which preauth key the connecting node redeemed (
GET /nodesnow reportspreauthKeyId, never key material) and refuses any node that did not redeem that job's own key.
Known gaps
- The relay registration protocol has not been independently audited. It runs sidecar to relay only, so a fix is a server deploy, not a fleet update.
- Relay registration endpoints have no rate limiting yet.
- Connections that cannot go direct depend on Tailscale's public DERP relays, which see only encrypted traffic.