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(remote-access): fail closed on disabled auth
cyh7a7df4904e4e
diff --git a/tests/test_remote_access_vibe_cloud.py b/tests/test_remote_access_vibe_cloud.pyindex 909b47586..67887397e 100644--- a/tests/test_remote_access_vibe_cloud.py+++ b/tests/test_remote_access_vibe_cloud.py@@ -315,6 +315,22 @@ def test_start_revalidates_config_after_connector_lock(monkeypatch, tmp_path) ->assert load_lock_states == [False, True]+def test_start_returns_structured_error_when_initial_config_load_fails(monkeypatch, tmp_path) -> None:+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))++ def fail_load():+ raise ValueError("corrupt config")++ monkeypatch.setattr(remote_access.V2Config, "load", fail_load)++ result = remote_access.start()++ assert result["ok"] is False+ assert result["error"] == "remote_access_config_load_failed"+ assert result["started"] is False+ assert "corrupt config" in result["detail"]++def test_start_uses_current_persisted_config_over_stale_argument(monkeypatch, tmp_path) -> None:monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))stale_config = _config()diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.pyindex 7cd974430..119d690e8 100644--- a/tests/test_ui_remote_access_auth.py+++ b/tests/test_ui_remote_access_auth.py@@ -397,6 +397,38 @@ def test_remote_callback_rejects_nonce_mismatch(monkeypatch, tmp_path):assert response.get_json()["error"] == "invalid_oauth_nonce"+def test_remote_callback_rejects_when_remote_access_is_disabled(monkeypatch, tmp_path):+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))+ config = _save_config(tmp_path)+ client = app.test_client()+ oauth_cookie = ui_server._make_oauth_cookie(+ config.remote_access.vibe_cloud.session_secret,+ {+ "state": "state-1",+ "nonce": "nonce-1",+ "code_verifier": "verifier-1",+ "next": "/dashboard",+ "exp": int(ui_server.datetime.now().timestamp()) + 300,+ },+ )+ config.remote_access.vibe_cloud.enabled = False+ config.save()+ exchange_calls = []+ client.set_cookie(ui_server.REMOTE_OAUTH_COOKIE_NAME, oauth_cookie, domain="alex.avibe.bot")++ monkeypatch.setattr(+ remote_access,+ "exchange_oauth_code",+ lambda *args, **kwargs: exchange_calls.append(args) or {"claims": {"nonce": "nonce-1"}},+ )++ response = client.get("/auth/callback?code=test-code&state=state-1", base_url="https://alex.avibe.bot")++ assert response.status_code == 400+ assert response.get_json()["error"] == "remote_access_disabled"+ assert exchange_calls == []++def test_remote_callback_sanitizes_protocol_relative_next(monkeypatch, tmp_path):monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))config = _save_config(tmp_path)diff --git a/vibe/remote_access.py b/vibe/remote_access.pyindex 24bfc165f..598537784 100644--- a/vibe/remote_access.py+++ b/vibe/remote_access.py@@ -286,12 +286,17 @@ def rotate_session_secret(config: V2Config) -> None:def start(config: V2Config | None = None) -> dict[str, Any]:- config = config or V2Config.load()+ fallback_config = config+ if fallback_config is None:+ try:+ fallback_config = V2Config.load()+ except Exception as exc:+ return {"ok": False, "error": "remote_access_config_load_failed", "detail": str(exc), "started": False}with _CONNECTOR_LOCK:try:config = V2Config.load()except Exception as exc:- stop_result = stop(config)+ stop_result = stop(fallback_config)return {**stop_result, "ok": False, "error": "remote_access_config_load_failed", "detail": str(exc)}cloud = config.remote_access.vibe_cloudif not cloud.enabled:diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 877df24c5..b2e13d0d7 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -705,6 +705,8 @@ def remote_access_auth_callback():if config is None or not _is_remote_access_request(config):return jsonify({"error": "remote_access_not_enabled"}), 400cloud = config.remote_access.vibe_cloud+ if not cloud.enabled:+ return jsonify({"error": "remote_access_disabled"}), 400oauth_state = _read_oauth_cookie(cloud.session_secret, request.cookies.get(REMOTE_OAUTH_COOKIE_NAME))if not oauth_state or oauth_state.get("state") != request.args.get("state"):return jsonify({"error": "invalid_oauth_state"}), 400