Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(ui_server): support tailscale ipv6 wildcard trust

cyh4c814484becd
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 48407cb55..d008139e9 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -1329,6 +1329,36 @@ def test_setup_host_ipv6_wildcard_allows_actual_private_interface_host(monkeypat
assert response.status_code == 200
+def test_setup_host_ipv6_wildcard_allows_tailscale_ula_interface_host(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "::")
+ _mock_interface(monkeypatch, "fd7a:115c:a1e0::5", 64, name="tailscale0")
+
+ response = app.test_client().get(
+ "/health",
+ base_url="http://[fd7a:115c:a1e0::5]:5123",
+ environ_base={"REMOTE_ADDR": "fd7a:115c:a1e0::20"},
+ )
+
+ assert response.status_code == 200
+
+
+def test_setup_host_ipv6_wildcard_does_not_trust_bridge_in_tailscale_ula_range(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "::")
+ _mock_interface(monkeypatch, "fd7a:115c:a1e0::5", 64, name="docker0")
+
+ response = app.test_client().get(
+ "/dashboard",
+ base_url="http://[fd7a:115c:a1e0::5]:5123",
+ environ_base={"REMOTE_ADDR": "fd7a:115c:a1e0::20"},
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
+
+
def test_setup_host_with_cloudflare_metadata_is_not_local(monkeypatch, tmp_path):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
_save_config_with_setup_host(tmp_path, "192.168.2.3")
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 05273fa2b..8359cab06 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -259,6 +259,7 @@ def _is_loopback_host(value: str | None) -> bool:
# such as Tailscale assign 100.x.y.z addresses that should be trusted as local
# setup-host peers when the request's Host header otherwise matches.
_SHARED_ADDRESS_SPACE = ipaddress.ip_network("100.64.0.0/10")
+_TAILSCALE_IPV6_ADDRESS_SPACE = ipaddress.ip_network("fd7a:115c:a1e0::/48")
# Networks that are scoped by the overlay/link itself rather than by the
# kernel's interface routing, so peers anywhere in the block are trusted
@@ -492,7 +493,12 @@ def _is_wildcard_setup_host(setup_host: str) -> bool:
def _allows_wildcard_setup_host_trust(interface_name: str, address: ipaddress._BaseAddress) -> bool:
normalized_name = interface_name.lower()
- if isinstance(address, ipaddress.IPv4Address) and address in _SHARED_ADDRESS_SPACE:
+ if (
+ isinstance(address, ipaddress.IPv4Address)
+ and address in _SHARED_ADDRESS_SPACE
+ or isinstance(address, ipaddress.IPv6Address)
+ and address in _TAILSCALE_IPV6_ADDRESS_SPACE
+ ):
return normalized_name.startswith(_WILDCARD_TRUST_OVERLAY_INTERFACE_PREFIXES)
return normalized_name.startswith(_WILDCARD_TRUST_LAN_INTERFACE_PREFIXES)