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(regression): limit docker trust to probes

cyhb51a1a020420
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 914af4516..91a5b9dd7 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -100,7 +100,7 @@ def test_docker_loopback_host_requires_explicit_trust(monkeypatch, tmp_path):
assert response.get_json()["error"] == "remote_access_host_mismatch"
-def test_docker_loopback_host_is_local_when_explicitly_trusted(monkeypatch, tmp_path):
+def test_docker_loopback_health_probe_is_allowed_when_explicitly_trusted(monkeypatch, tmp_path):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
monkeypatch.setenv("VIBE_REMOTE_ALLOW_DOCKER_LOOPBACK_PEERS", "1")
monkeypatch.setenv("VIBE_REMOTE_DOCKER_LOOPBACK_BIND_HOST", "127.0.0.1")
@@ -115,6 +115,37 @@ def test_docker_loopback_host_is_local_when_explicitly_trusted(monkeypatch, tmp_
assert response.status_code == 200
+def test_docker_loopback_status_probe_is_allowed_when_explicitly_trusted(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ monkeypatch.setenv("VIBE_REMOTE_ALLOW_DOCKER_LOOPBACK_PEERS", "1")
+ monkeypatch.setenv("VIBE_REMOTE_DOCKER_LOOPBACK_BIND_HOST", "127.0.0.1")
+ _save_config(tmp_path)
+
+ response = app.test_client().get(
+ "/status",
+ base_url="http://127.0.0.1:15130",
+ environ_base={"REMOTE_ADDR": "172.17.0.1"},
+ )
+
+ assert response.status_code == 200
+
+
+def test_docker_loopback_trust_does_not_bypass_ui_auth(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ monkeypatch.setenv("VIBE_REMOTE_ALLOW_DOCKER_LOOPBACK_PEERS", "1")
+ monkeypatch.setenv("VIBE_REMOTE_DOCKER_LOOPBACK_BIND_HOST", "127.0.0.1")
+ _save_config(tmp_path)
+
+ response = app.test_client().get(
+ "/dashboard",
+ base_url="http://127.0.0.1:15130",
+ environ_base={"REMOTE_ADDR": "172.17.0.1"},
+ )
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
+
+
def test_docker_loopback_trust_requires_loopback_port_binding(monkeypatch, tmp_path):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
monkeypatch.setenv("VIBE_REMOTE_ALLOW_DOCKER_LOOPBACK_PEERS", "1")
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 92fcc3def..ab064fa40 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -265,16 +265,26 @@ def _is_trusted_docker_peer() -> bool:
return False
-def _is_local_request() -> bool:
+def _is_trusted_docker_loopback_probe() -> bool:
+ if request.method not in {"GET", "HEAD"}:
+ return False
+ if request.path not in {"/health", "/status"}:
+ return False
if _has_cloudflare_forwarded_metadata():
return False
if not _is_loopback_host(request.host):
return False
- if _is_loopback_peer():
- return True
return _is_trusted_docker_peer()
+def _is_local_request() -> bool:
+ if _has_cloudflare_forwarded_metadata():
+ return False
+ if not _is_loopback_host(request.host):
+ return False
+ return _is_loopback_peer()
+
+
def _normalized_host(value: str | None) -> str:
raw_host = (value or "").lower().strip()
if raw_host.startswith("[") and "]" in raw_host:
@@ -414,15 +424,16 @@ def _redirect_to_vibe_cloud_login(config: V2Config):
def enforce_remote_access_cookie():
config = _load_remote_access_config()
local_request = _is_local_request()
+ docker_probe_request = _is_trusted_docker_loopback_probe()
if config is None:
- if local_request:
+ if local_request or docker_probe_request:
return None
return jsonify({"ok": False, "error": "remote_access_config_unavailable"}), 503
- if _remote_access_public_url_invalid(config) and not local_request:
+ if _remote_access_public_url_invalid(config) and not (local_request or docker_probe_request):
return jsonify({"ok": False, "error": "remote_access_public_url_invalid"}), 503
remote_request = _is_remote_access_request(config)
if not remote_request:
- if not local_request:
+ if not local_request and not docker_probe_request:
return jsonify({"ok": False, "error": "remote_access_host_mismatch"}), 503
return None
if _remote_auth_exempt_path():