Repository navigation
fix(server): an explicit Tailscale IPv6 bind is advertised as a tailnet route #34742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ export class DirectEndpoints extends Context.Service< | |
| >()("t3/environment/DirectEndpoints") {} | ||
|
|
||
| // Credentials travel over HTTP; public IPs leak them and hostnames can resolve differently per client. | ||
| // Wildcard binds stay IPv4: the private-network listener check accepts only IPv4 peers. | ||
| const isAdvertisableAddress = (address: string): boolean => | ||
| NodeNet.isIPv4(address) && !address.startsWith("127.") && isPrivateNetworkAddress(address); | ||
|
|
||
|
|
@@ -78,7 +79,10 @@ export function resolveBoundEndpoints(input: { | |
| !(input.platform === "win32" && WINDOWS_HOST_ADAPTER_MAC.test(entry.mac)), | ||
| ) | ||
| .map((entry) => entry.address) | ||
| : [input.host!].filter(isAdvertisableAddress); | ||
| : [input.host!].filter( | ||
| (address) => | ||
| isAdvertisableAddress(address) || (NodeNet.isIPv6(address) && isTailnetHost(address)), | ||
| ); | ||
| return [...new Set(addresses)] | ||
| .filter((address) => !input.onCloudVm || tailscaleAddresses.has(address)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High An explicitly bound IPv6 tailnet address can be returned as 🚀 Reply "fix it for me" or copy this AI Prompt for your agent: |
||
| .map((address) => ({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lowercase the explicit host before the tailnet check.
An explicit IPv6 host typed in mixed case, such as
FD7A:115C:A1E0::1, passesisTailnetHost, which lowercases internally. The unchanged string is then looked up intailscaleAddresses, whose entries come from the interface list in lowercase. The lookup misses, so the endpoint can be labeledlaninstead oftailnet. A client that selects routes bykindmay then skip this route.Lowercasing the host before the classification makes the spelling match the interface addresses. IPv6 hex digits are case-insensitive, so the URL remains valid. IPv4 and hostname inputs are not affected. Add a row for an uppercase explicit IPv6 host to the existing
resolveBoundEndpointscase table.Suggested fix