Relay

Security

What a Viewport Relay can see, how a daemon owns its hub, what relay tokens grant, and the limits that bound a flood.

The relay sees metadata, never plaintext

It sees hub ids, client IPs, which hub each viewer attaches to, connection counts, message sizes and timing. Channel bodies are Noise messages between the viewer's key and the daemon's key, and the relay never parses them. It passes daemons an ip_hash (an HMAC with a per-process salt, per hub) instead of the viewer's IP. Hiding metadata from the relay operator is out of scope for v1.

A daemon owns its hub by proof

Each registration proves the daemon's X25519 key through an HKDF-derived proof bound to this relay's origin. A token holder cannot take another daemon's hub, and a relay cannot replay a daemon's answer elsewhere. The proof vector is pinned in the relay's tests and design document.

Relay tokens are operator credentials, not daemon access

Tokens decide who may use the relay. Pairing and every request go through the daemon's key, so a malicious relay or token holder can deny service but cannot read a channel or pair with a daemon.

Denial-of-service bounds

The defaults, all overridable:

LimitDefault
WebSocket upgrades per IP120 per minute (plain HTTP 429 past twice that)
Connections2,000 in total, 50 per IP, 64 viewers per hub
Message size65,600 bytes
Buffer per socket4 MiB

The daemon socket is shared by every viewer of its hub, so its buffer is accounted per viewer. The viewer holding the largest share over its fair share is cut (close code 4013), never the daemon for a viewer's traffic. Past twice the budget, viewer traffic is held back. Past four times, or without draining at least min(64 KiB, budget / 4) in 10 seconds, the daemon socket is closed. A viewer cut for not reading backs off per IP and hub: the first cut is forgiven, then 2 seconds, doubling to 5 minutes.

Known limits

  • State lives in memory in one process. A restart drops every connection, and clients reconnect.
  • The offender table holds 10,000 (IP, hub) keys. An attacker cut from more keys than that, across many IPs, can evict an older offender early. The daemon socket's hard cap, not the table, bounds memory.
  • Per-IP limits do not stop a distributed flood from filling the global connection cap.
  • --open admits anyone on loopback and refuses proxied requests. Never put it behind a reverse proxy.

Report vulnerabilities privately through the repository's security advisories, or email [email protected] with "security" in the subject.

On this page