Repository navigation
fix(server): guard the page's origin against other sites - #70
Merged
Merged
Conversation
The server held no line around its origin. A site that rebinds its name to the server's address was same-origin with it, and any other site could call /h/, /a/ and /config.json, read host answers through the relay, and reach into the LAN through a server nobody exposed. A request now names an address, a local name or one in TLS_NAMES, or gets 421; only an operator certificate with no names skips that. Every route but the static files refuses another site's request, with one check where the bridge and wake had two. The relay passes an allowlist of headers each way, so a visitor cannot vouch for itself to a host and a host cannot set cookies, prompts, CORS or storage wipes on the page's origin. The page carries a CSP, nosniff, no-referrer and COOP. BREAKING CHANGE: a page opened at a domain, behind a proxy or tunnel, needs that domain in TLS_NAMES, and the proxy must pass Host through.
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.
The page server held no line around its own origin. This is the first of two pull requests that harden it for people who expose it (design: planning
design/web-client-exposure.md); it stands alone and closes the two holes that also reach a server nobody exposed.localhost, one label,.local,.home.arpa,.internal) or one inTLS_NAMES, or it gets421. A site that rebinds its own name to the server's address is no longer same-origin with it. With an operator certificate and noTLS_NAMESthere is no check: the browser has already refused other names./h/,/a/,/w/,/wa/,/wake/and/config.jsonrefuse a request another site made (Sec-Fetch-Site,Origin). One check where the bridge and wake had two.authorization,content-type,accept,if-none-match,content-length, the set the host's own tunnel passes. Coming back: what describes the body and its caching. A host can no longer set CORS, a cookie,Clear-Site-Data, a credential prompt or a redirect target on the page's origin.nosniff,no-referrer, COOP. No HSTS from the server: it binds a name, not a port, and would break other plain-HTTP services on a shared hostname.Breaking
A page opened at a domain behind a reverse proxy or tunnel needs that domain in
TLS_NAMES, and the proxy must passHostthrough unchanged. The421names the variable;compose.proxy.yamlandcompose.tailscale.yamlcarry the line.Checked
server/: fmt, clippy-D warnings, 26 tests./and/?ui=console, with no violation; stand-in probes for the worklet, the bridge socket, WebTransport and blob, data and https images raise none, and an injected script is blocked.Not checked
Firefox, and every streaming path under the CSP (real worklets, a plane session, art and avatars). Owed on glass before a release.