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): whitelist wildcard trusted interfaces

cyh745bee0f03bb
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 48207cb70..48407cb55 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -1188,6 +1188,54 @@ def test_setup_host_wildcard_does_not_trust_docker_bridge_interface(monkeypatch,
assert response.get_json()["error"] == "remote_access_host_mismatch"
+def test_setup_host_wildcard_does_not_trust_cni_bridge_interface(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "0.0.0.0")
+ _mock_interface(monkeypatch, "192.168.2.3", 24, name="cni0")
+
+ response = app.test_client().get(
+ "/dashboard",
+ base_url="http://192.168.2.3:5123",
+ environ_base={"REMOTE_ADDR": "192.168.2.5"},
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
+
+
+def test_setup_host_wildcard_does_not_trust_flannel_interface(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "0.0.0.0")
+ _mock_interface(monkeypatch, "10.244.0.1", 24, name="flannel.1")
+
+ response = app.test_client().get(
+ "/dashboard",
+ base_url="http://10.244.0.1:5123",
+ environ_base={"REMOTE_ADDR": "10.244.0.2"},
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
+
+
+def test_setup_host_wildcard_does_not_trust_bridge_interface_in_cgnat_range(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config_with_setup_host(tmp_path, "0.0.0.0")
+ _mock_interface(monkeypatch, "100.97.103.112", 32, name="docker0")
+
+ response = app.test_client().get(
+ "/dashboard",
+ base_url="http://100.97.103.112:5123",
+ environ_base={"REMOTE_ADDR": "100.97.103.5"},
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
+
+
def test_setup_host_wildcard_rejects_peer_outside_interface_subnet(monkeypatch, tmp_path):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
_save_config_with_setup_host(tmp_path, "0.0.0.0")
@@ -1240,7 +1288,7 @@ def test_setup_host_wildcard_with_reverse_proxy_header_is_not_local(monkeypatch,
def test_setup_host_wildcard_allows_actual_tailscale_interface_host(monkeypatch, tmp_path):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
_save_config_with_setup_host(tmp_path, "0.0.0.0")
- _mock_interface(monkeypatch, "100.97.103.112", 32)
+ _mock_interface(monkeypatch, "100.97.103.112", 32, name="tailscale0")
response = app.test_client().get(
"/health",
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 45f4e7205..05273fa2b 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -273,15 +273,19 @@ _OVERLAY_TRUST_NETWORKS_V4 = (
ipaddress.IPv4Network("169.254.0.0/16"),
)
_OVERLAY_TRUST_NETWORKS_V6 = (ipaddress.IPv6Network("fe80::/10"),)
-_WILDCARD_TRUST_EXCLUDED_INTERFACE_PREFIXES = (
- "br-",
- "bridge",
- "docker",
- "podman",
- "vboxnet",
- "veth",
- "virbr",
- "vmnet",
+_WILDCARD_TRUST_LAN_INTERFACE_PREFIXES = (
+ "en",
+ "eth",
+ "ethernet",
+ "local area connection",
+ "wi-fi",
+ "wifi",
+ "wl",
+ "wwan",
+)
+_WILDCARD_TRUST_OVERLAY_INTERFACE_PREFIXES = (
+ "tailscale",
+ "utun",
)
@@ -487,11 +491,10 @@ def _is_wildcard_setup_host(setup_host: str) -> bool:
def _allows_wildcard_setup_host_trust(interface_name: str, address: ipaddress._BaseAddress) -> bool:
- if isinstance(address, ipaddress.IPv4Address) and address in _SHARED_ADDRESS_SPACE:
- return True
-
normalized_name = interface_name.lower()
- return not normalized_name.startswith(_WILDCARD_TRUST_EXCLUDED_INTERFACE_PREFIXES)
+ if isinstance(address, ipaddress.IPv4Address) and address in _SHARED_ADDRESS_SPACE:
+ return normalized_name.startswith(_WILDCARD_TRUST_OVERLAY_INTERFACE_PREFIXES)
+ return normalized_name.startswith(_WILDCARD_TRUST_LAN_INTERFACE_PREFIXES)
def _is_wildcard_setup_host_request(config: V2Config | None) -> bool:
@@ -499,8 +502,9 @@ def _is_wildcard_setup_host_request(config: V2Config | None) -> bool:
``0.0.0.0``/``::`` is a listen address, not a trusted browser host. For
compatibility with LAN direct access, accept requests to a concrete local
- private interface IP while keeping arbitrary private Host spoofing and
- public-IP exposure behind the normal remote-access checks.
+ private IP on a small allowlist of LAN/overlay interfaces while keeping
+ arbitrary private Host spoofing, container bridge networks, and public-IP
+ exposure behind the normal remote-access checks.
"""
if config is None:
return False