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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(ui_server): exclude bridge interfaces from wildcard trust
cyh152abbb2a79f
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.pyindex e02191ffb..48207cb70 100644--- a/tests/test_ui_remote_access_auth.py+++ b/tests/test_ui_remote_access_auth.py@@ -16,7 +16,7 @@ from vibe.ui_server import app_FakeSnicaddr = namedtuple("snicaddr", ["family", "address", "netmask", "broadcast", "ptp"])-def _mock_interface(monkeypatch, ip: str, prefix: int) -> None:+def _mock_interface(monkeypatch, ip: str, prefix: int, name: str = "en0") -> None:"""Make ``psutil.net_if_addrs()`` report ``ip`` with the given prefixlength so ``_local_interface_network`` returns the expected subnet.Tests that exercise the RFC1918/ULA trust path need this because the@@ -30,7 +30,7 @@ def _mock_interface(monkeypatch, ip: str, prefix: int) -> None:family = socket.AF_INET6netmask = str(ipaddress.IPv6Network(f"::/{prefix}").netmask)snic = _FakeSnicaddr(family=family, address=ip, netmask=netmask, broadcast=None, ptp=None)- monkeypatch.setattr("vibe.ui_server.psutil.net_if_addrs", lambda: {"en0": [snic]})+ monkeypatch.setattr("vibe.ui_server.psutil.net_if_addrs", lambda: {name: [snic]})def _mock_no_interfaces(monkeypatch) -> None:@@ -1172,6 +1172,22 @@ def test_setup_host_wildcard_does_not_trust_unconfigured_lan_host(monkeypatch, tassert response.get_json()["error"] == "remote_access_host_mismatch"+def test_setup_host_wildcard_does_not_trust_docker_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, "172.17.0.1", 16, name="docker0")++ response = app.test_client().get(+ "/dashboard",+ base_url="http://172.17.0.1:5123",+ environ_base={"REMOTE_ADDR": "172.17.0.2"},+ 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")diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex c1291e82c..45f4e7205 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -13,7 +13,7 @@ import socketimport threadingfrom datetime import datetimefrom pathlib import Path-from typing import Any+from typing import Any, Callablefrom urllib.parse import quote, unquote, urlparse, urlsplit, urlunsplitimport psutil@@ -273,6 +273,16 @@ _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",+)def _is_private_address(address: ipaddress._BaseAddress) -> bool:@@ -297,7 +307,10 @@ def _is_private_peer() -> bool:return False-def _local_interface_network(setup_address: ipaddress._BaseAddress) -> ipaddress._BaseNetwork | None:+def _local_interface_network(+ setup_address: ipaddress._BaseAddress,+ interface_filter: Callable[[str, ipaddress._BaseAddress], bool] | None = None,+) -> ipaddress._BaseNetwork | None:"""Return the network ``setup_host`` is configured on locally.Reads the interface's actual netmask via ``psutil.net_if_addrs`` so@@ -315,7 +328,7 @@ def _local_interface_network(setup_address: ipaddress._BaseAddress) -> ipaddressexcept Exception:return Nonetarget_family = socket.AF_INET if setup_address.version == 4 else socket.AF_INET6- for addrs in interfaces.values():+ for interface_name, addrs in interfaces.items():for snic in addrs:if snic.family != target_family:continue@@ -326,6 +339,8 @@ def _local_interface_network(setup_address: ipaddress._BaseAddress) -> ipaddresscontinueif addr != setup_address:continue+ if interface_filter is not None and not interface_filter(interface_name, addr):+ continuenetmask = snic.netmaskif not netmask:continue@@ -471,6 +486,14 @@ def _is_wildcard_setup_host(setup_host: str) -> bool:return setup_host in {"0.0.0.0", "::", "*"}+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)++def _is_wildcard_setup_host_request(config: V2Config | None) -> bool:"""Treat wildcard binds as local only through an actual private interface.@@ -493,7 +516,7 @@ def _is_wildcard_setup_host_request(config: V2Config | None) -> bool:return Falseif not _is_private_address(host_address):return False- if _local_interface_network(host_address) is None:+ if _local_interface_network(host_address, interface_filter=_allows_wildcard_setup_host_trust) is None:return Falseif _has_forwarded_metadata():return False