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): restore compat request semantics

cyhf96d266e6a61
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 5cea0d58f..8c65ac70a 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -131,6 +131,21 @@ def test_remote_host_with_trailing_dot_still_requires_login(monkeypatch, tmp_pat
assert response.headers["Location"].startswith("https://backend.test/oauth/authorize?")
+def test_remote_health_does_not_require_remote_access_cookie(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ _save_config(tmp_path)
+
+ response = app.test_client().get(
+ "/health",
+ base_url="https://alex.avibe.bot",
+ environ_base=_remote_peer(),
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 200
+ assert response.get_json()["status"] == "ok"
+
+
def test_localhost_does_not_require_remote_access_cookie(monkeypatch, tmp_path):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
_save_config(tmp_path)
diff --git a/tests/test_ui_server_mutation_protection.py b/tests/test_ui_server_mutation_protection.py
index 3856c2c83..e73a04a04 100644
--- a/tests/test_ui_server_mutation_protection.py
+++ b/tests/test_ui_server_mutation_protection.py
@@ -56,6 +56,21 @@ def test_config_post_rejects_missing_csrf_token(monkeypatch, tmp_path):
assert response.get_json()["message"] == "Forbidden: invalid csrf token"
+def test_config_post_rejects_malformed_json(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ client = app.test_client()
+ headers = csrf_headers(client, "http://127.0.0.1:15131")
+
+ response = client.post(
+ "/config",
+ content="{",
+ headers={**headers, "Content-Type": "application/json"},
+ base_url="http://127.0.0.1:15131",
+ )
+
+ assert response.status_code == 400
+
+
def test_config_post_allows_forwarded_origin(monkeypatch, tmp_path):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
V2Config(
diff --git a/vibe/ui_compat.py b/vibe/ui_compat.py
index f26d38606..404b1905f 100644
--- a/vibe/ui_compat.py
+++ b/vibe/ui_compat.py
@@ -15,6 +15,7 @@ from fastapi import FastAPI, Request as FastAPIRequest
from fastapi.responses import FileResponse, JSONResponse, RedirectResponse, Response as StarletteResponse
from fastapi.testclient import TestClient
from starlette.concurrency import run_in_threadpool
+from starlette.exceptions import HTTPException
from starlette.datastructures import Headers, QueryParams, URL
@@ -482,7 +483,7 @@ async def _read_json_payload(request: FastAPIRequest) -> Any:
try:
return json.loads(body)
except json.JSONDecodeError:
- return None
+ raise HTTPException(status_code=400, detail="Malformed JSON")
def _build_scope(method: str, url: str, headers: dict[str, str]) -> dict[str, Any]:
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index dbda7537a..5749d094e 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -919,6 +919,8 @@ def enforce_remote_access_cookie():
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():
+ return None
from vibe import remote_access
if not config.remote_access.vibe_cloud.enabled: