fix(web_server): accept Tailscale MagicDNS hostnames in host header check - #82028
Open
robottwo wants to merge 1 commit into
Open
fix(web_server): accept Tailscale MagicDNS hostnames in host header check#82028robottwo wants to merge 1 commit into
robottwo wants to merge 1 commit into
Conversation
…heck When the web dashboard is bound to loopback and exposed via `tailscale serve`, the Host header contains the Tailscale MagicDNS hostname (e.g. machine.tail1234.ts.net) rather than localhost. The current host header validation rejects these requests with a 403 because *.ts.net is not in _LOOPBACK_HOST_VALUES, making the dashboard inaccessible through the standard Tailscale serve proxy pattern. Accept *.ts.net suffixes when bound to loopback, since tailscale serve already provides authenticated, encrypted transport to the loopback listener.
Collaborator
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.
Problem
When the web dashboard is bound to loopback (default) and exposed via
tailscale serve, the Host header contains the Tailscale MagicDNS hostname (e.g.machine.tail1234.ts.net) rather thanlocalhost.The current
_is_accepted_hostvalidation rejects these requests with a 403 because*.ts.netis not in_LOOPBACK_HOST_VALUES. This makes the dashboard inaccessible through the standardtailscale serveproxy pattern documented at https://tailscale.com/kb/1247/funnel-serve-use-cases.Setup
Browser visits
https://machine.tail1234.ts.net/→ 403 Forbidden.Fix
Accept
*.ts.netsuffixes in_is_accepted_hostwhen bound to loopback.tailscale serveproxies to localhost over an already-authenticated, encrypted tailnet tunnel, so the Host-header defense is not bypassed — the trust boundary is the Tailscale connection itself.The change is scoped: only
.ts.netsuffixes are accepted, and only when the server is bound to loopback. Non-loopback binds still require exact host match.Testing
https://machine.tailf2f193.ts.net/after patchlocalhost:9119and127.0.0.1:9119still workevil.com) still rejected with 403