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(remote-access): fail closed on host mismatch

cyhcaff5bdf4914
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 6e719d5bc..75dfb82d9 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -71,6 +71,16 @@ def test_localhost_does_not_require_remote_access_cookie(monkeypatch, tmp_path):
assert response.status_code == 200
+def test_unmatched_non_local_host_fails_closed_when_remote_access_enabled(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config(tmp_path)
+
+ response = app.test_client().get("/dashboard", base_url="https://old-alex.avibe.bot", follow_redirects=False)
+
+ assert response.status_code == 503
+ assert response.get_json()["error"] == "remote_access_host_mismatch"
+
+
def test_remote_host_allows_valid_remote_session(monkeypatch, tmp_path):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
config = _save_config(tmp_path)
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 1532e5051..7beafa583 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -340,13 +340,19 @@ def _redirect_to_vibe_cloud_login(config: V2Config):
@app.before_request
def enforce_remote_access_cookie():
config = _load_remote_access_config()
+ local_request = _is_local_request_host()
if config is None:
- if _is_local_request_host():
+ if local_request:
return None
return jsonify({"ok": False, "error": "remote_access_config_unavailable"}), 503
- if _remote_access_public_url_invalid(config) and not _is_local_request_host():
+ if _remote_access_public_url_invalid(config) and not local_request:
return jsonify({"ok": False, "error": "remote_access_public_url_invalid"}), 503
- if not _is_remote_access_request(config) or _remote_auth_exempt_path():
+ remote_request = _is_remote_access_request(config)
+ if not remote_request:
+ if config.remote_access.vibe_cloud.enabled and not local_request:
+ return jsonify({"ok": False, "error": "remote_access_host_mismatch"}), 503
+ return None
+ if _remote_auth_exempt_path():
return None
from vibe import remote_access