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): trust wildcard LAN interface hosts
cyh832cbf16e979
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.pyindex 15cbd6e1f..e02191ffb 100644--- a/tests/test_ui_remote_access_auth.py+++ b/tests/test_ui_remote_access_auth.py@@ -1142,14 +1142,78 @@ def test_setup_host_mismatched_host_header_is_not_local(monkeypatch, tmp_path):assert response.get_json()["error"] == "remote_access_host_mismatch"-def test_setup_host_wildcard_does_not_grant_local_trust(monkeypatch, tmp_path):+def test_setup_host_wildcard_allows_actual_lan_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, "192.168.2.3", 24)++ response = app.test_client().get(+ "/health",+ base_url="http://192.168.2.3:5123",+ environ_base={"REMOTE_ADDR": "192.168.2.5"},+ )++ assert response.status_code == 200+++def test_setup_host_wildcard_does_not_trust_unconfigured_lan_host(monkeypatch, tmp_path):+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))+ _save_config_with_setup_host(tmp_path, "0.0.0.0")+ _mock_no_interfaces(monkeypatch)++ 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_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")+ _mock_interface(monkeypatch, "192.168.1.5", 24)++ response = app.test_client().get(+ "/dashboard",+ base_url="http://192.168.1.5: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_rejects_public_peer(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)++ response = app.test_client().get(+ "/dashboard",+ base_url="http://192.168.2.3:5123",+ environ_base={"REMOTE_ADDR": "8.8.8.8"},+ follow_redirects=False,+ )++ assert response.status_code == 503+ assert response.get_json()["error"] == "remote_access_host_mismatch"+++def test_setup_host_wildcard_with_reverse_proxy_header_is_not_local(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)response = app.test_client().get("/dashboard",base_url="http://192.168.2.3:5123",environ_base={"REMOTE_ADDR": "192.168.2.5"},+ headers={"X-Forwarded-For": "203.0.113.10"},follow_redirects=False,)@@ -1157,6 +1221,50 @@ def test_setup_host_wildcard_does_not_grant_local_trust(monkeypatch, tmp_path):assert response.get_json()["error"] == "remote_access_host_mismatch"+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)++ response = app.test_client().get(+ "/health",+ base_url="http://100.97.103.112:5123",+ environ_base={"REMOTE_ADDR": "100.97.103.5"},+ )++ assert response.status_code == 200+++def test_setup_host_wildcard_does_not_trust_unconfigured_tailscale_host(monkeypatch, tmp_path):+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))+ _save_config_with_setup_host(tmp_path, "0.0.0.0")+ _mock_no_interfaces(monkeypatch)++ 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_ipv6_wildcard_allows_actual_private_interface_host(monkeypatch, tmp_path):+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))+ _save_config_with_setup_host(tmp_path, "::")+ _mock_interface(monkeypatch, "fd00::5", 64)++ response = app.test_client().get(+ "/health",+ base_url="http://[fd00::5]:5123",+ environ_base={"REMOTE_ADDR": "fd00::20"},+ )++ assert response.status_code == 200++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.pyindex ec02bceac..c1291e82c 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -467,12 +467,49 @@ def _is_trusted_docker_loopback_probe() -> bool:return _is_trusted_docker_peer()+def _is_wildcard_setup_host(setup_host: str) -> bool:+ return setup_host in {"0.0.0.0", "::", "*"}+++def _is_wildcard_setup_host_request(config: V2Config | None) -> bool:+ """Treat wildcard binds as local only through an actual private interface.++ ``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.+ """+ if config is None:+ return False+ setup_host = _normalized_host(getattr(config.ui, "setup_host", ""))+ if not _is_wildcard_setup_host(setup_host):+ return False++ try:+ host_address = ipaddress.ip_address(_normalized_host(request.host))+ except ValueError:+ return False+ if host_address.is_unspecified:+ return False+ if not _is_private_address(host_address):+ return False+ if _local_interface_network(host_address) is None:+ return False+ if _has_forwarded_metadata():+ return False+ if not _is_private_peer():+ return False+ return _peer_shares_setup_host_network(host_address)++def _is_setup_host_request(config: V2Config | None) -> bool:if config is None:return Falsesetup_host = _normalized_host(getattr(config.ui, "setup_host", ""))- if not setup_host or setup_host in {"0.0.0.0", "::", "*"}:+ if not setup_host:return False+ if _is_wildcard_setup_host(setup_host):+ return _is_wildcard_setup_host_request(config)if _is_loopback_host(setup_host):return False# Only trust setup-host requests when setup_host parses to a private/CGNAT