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): confine execution-affecting writes
Maxfc64f12d6f7c
diff --git a/docs/plans/2026-08-04-org-master-conservative-harness-gate.md b/docs/plans/2026-08-04-org-master-conservative-harness-gate.mdindex 9a11b819b..220b291ac 100644--- a/docs/plans/2026-08-04-org-master-conservative-harness-gate.md+++ b/docs/plans/2026-08-04-org-master-conservative-harness-gate.md@@ -20,6 +20,11 @@ entitlement mirror before remote recurring execution can be enabled.- Keep trusted-local Workbench, CLI, Task, Watch, Agent, terminal, and filebehavior unchanged.- Keep IM-triggered Agent behavior unchanged.+- This phase provides no remote authorization for Harness execution or+ definition writes, Vault secret-bearing operations, IM ingress configuration,+ native Agent session forks, or non-read private Show Runtime routes; these+ capabilities remain trusted-local. Public `/p/<share_id>/...` flows are a+ separate sharing surface, not remote Workbench authorization.- Make every remote Workbench capability read-only with respect to local Agent,terminal, file, and Harness execution.- Reject remote Task and Watch creation or update at the definition service@@ -46,12 +51,15 @@ entitlement mirror before remote recurring execution can be enabled.process state, prompts, command output, and potentially credentials. The samepolicy payload-filters routes that persist future execution choices withexplicit safe-field allowlists: Session Agent/model overrides, Project- creation/workdir/default Agent, channel/thread/user cwd or routing, and- Agent/platform/runtime config sections. Unknown fields fail closed. Complete- config round-trips may preserve protected values but cannot change them, and- protected fields are stripped before persistence so a concurrent local update- cannot be overwritten by a stale remote round-trip. Explicit Session/Project- display fields and explicit UI/config preferences remain available.+ creation/workdir/default Agent, and Agent/platform/runtime config sections.+ IM channel and thread settings, native Agent session forks, and non-read+ private Show Runtime routes are explicitly trusted-local because they can+ alter future Agent ingress or invoke local runtime code. Unknown fields fail+ closed. Complete config round-trips may preserve protected values but cannot+ change them, and protected fields are stripped before persistence so a+ concurrent local update cannot be overwritten by a stale remote round-trip.+ Explicit Session/Project display fields and explicit UI/config preferences+ remain available.3. The durable Delivery owner retires remote-origin queue entries before theFIFO claim that starts an Agent turn.4. Task and Watch stores reject explicit remote definition writes.@@ -88,10 +96,11 @@ substitute for either dependency.- An unknown owner-only API route is trusted-local by default; remote exposurerequires an exact method/path policy entry and regression evidence. A new pathunder an already approved namespace does not inherit remote access.-- Remote execution-setting writes through Session, Project, channel, thread,+- Remote execution-setting writes through Session, Project, IM channel/thread,user, and config routes fail before any store save, runtime reconciliation, or- restart scheduling; unknown payload fields fail closed, while Session titles,- Project display names, and explicitly allowlisted UI preferences remain writable.+ restart scheduling. Remote native Agent forks and private Show Runtime writes+ fail before session persistence or runtime invocation; Session titles, Project+ display names, and explicitly allowlisted UI preferences remain writable.- Paired Project synchronization never forwards the device secret through anHTTP redirect.- Remote Task and Watch add/update calls produce no definition write.diff --git a/tests/test_instance_authorization.py b/tests/test_instance_authorization.pyindex 8805b26ef..935c2705e 100644--- a/tests/test_instance_authorization.py+++ b/tests/test_instance_authorization.py@@ -113,6 +113,7 @@ def test_http_policy_defaults_unknown_api_to_owner() -> None:assert required_instance_role("PUT", "/api/resource-policies/agent/agent-1") == "owner"assert required_instance_role("GET", "/api/sessions/ses-1/draft") == "editor"assert required_instance_role("POST", "/api/sessions/ses-1/messages") == "editor"+ assert required_instance_role("POST", "/api/sessions/ses-1/fork") == "editor"assert required_instance_role("POST", "/api/projects") == "owner"assert required_instance_role("GET", "/api/new-management-surface") == "owner"assert required_instance_role("GET", "/show/ses-1/") == "viewer"@@ -177,9 +178,15 @@ def test_remote_http_policy_defaults_local_machine_and_unknown_routes_to_local_o("GET", "/api/harness/runs/run-1", REMOTE_HTTP_ALLOWED),("GET", "/api/users", REMOTE_HTTP_ALLOWED),("GET", "/api/bind-codes", REMOTE_HTTP_ALLOWED),+ ("GET", "/show/ses-1/", REMOTE_HTTP_ALLOWED),("POST", "/api/config", REMOTE_HTTP_PAYLOAD_FILTERED),("PATCH", "/api/projects/proj-1", REMOTE_HTTP_PAYLOAD_FILTERED),("PATCH", "/api/sessions/ses-1", REMOTE_HTTP_PAYLOAD_FILTERED),+ ("POST", "/api/settings", REMOTE_HTTP_LOCAL_ONLY),+ ("POST", "/api/settings/thread", REMOTE_HTTP_LOCAL_ONLY),+ ("DELETE", "/api/settings/thread", REMOTE_HTTP_LOCAL_ONLY),+ ("POST", "/api/sessions/ses-1/fork", REMOTE_HTTP_LOCAL_ONLY),+ ("POST", "/show/ses-1/api/action", REMOTE_HTTP_LOCAL_ONLY),],)def test_remote_http_policy_keeps_approved_management_and_read_surfaces(diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.pyindex ea89aa5e9..b344223d6 100644--- a/tests/test_ui_remote_access_auth.py+++ b/tests/test_ui_remote_access_auth.py@@ -1022,7 +1022,7 @@ def test_remote_project_execution_settings_are_blocked_before_store_access(assert response.get_json()["code"] == "remote_execution_disabled"-def test_remote_scope_settings_block_execution_fields_but_allow_metadata(monkeypatch, tmp_path):+def test_remote_im_settings_are_rejected_before_store_access(monkeypatch, tmp_path):monkeypatch.setenv("AVIBE_HOME", str(tmp_path))config = _save_config(tmp_path)client = app.test_client()@@ -1032,28 +1032,22 @@ def test_remote_scope_settings_block_execution_fields_but_allow_metadata(monkeypdomain="alex.avibe.bot",)- monkeypatch.setattr(api, "save_settings", lambda payload: {"ok": True, "payload": payload})- allowed = client.post(- "/api/settings",- json={"platform": "slack", "channels": {"C1": {"enabled": False}}},- headers=csrf_headers(client, "https://alex.avibe.bot"),- base_url="https://alex.avibe.bot",- environ_base=_remote_peer(),+ monkeypatch.setattr(+ api,+ "save_settings",+ lambda payload: (_ for _ in ()).throw(+ AssertionError("remote IM configuration reached the local settings store")+ ),)- assert allowed.status_code == 200-- blocked = client.post(+ response = client.post("/api/settings",- json={- "platform": "slack",- "channels": {"C1": {"custom_cwd": "/tmp/remote"}},- },+ json={"platform": "slack", "channels": {"C1": {"enabled": False}}},headers=csrf_headers(client, "https://alex.avibe.bot"),base_url="https://alex.avibe.bot",environ_base=_remote_peer(),)- assert blocked.status_code == 403- assert blocked.get_json()["code"] == "remote_execution_disabled"+ assert response.status_code == 403+ assert response.get_json()["code"] == "remote_execution_disabled"def test_remote_thread_scope_settings_are_blocked_before_store_access(monkeypatch, tmp_path):@@ -1079,7 +1073,7 @@ def test_remote_thread_scope_settings_are_blocked_before_store_access(monkeypatc"platform": "telegram","channel_id": "channel-1","thread_id": "thread-1",- "settings": {"routing": {"agent_name": "codex"}},+ "settings": {"enabled": True},},headers=csrf_headers(client, "https://alex.avibe.bot"),base_url="https://alex.avibe.bot",@@ -1090,6 +1084,39 @@ def test_remote_thread_scope_settings_are_blocked_before_store_access(monkeypatcassert response.get_json()["code"] == "remote_execution_disabled"+def test_remote_session_fork_is_rejected_before_fork_reservation(monkeypatch, tmp_path):+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ config = _save_config(tmp_path)+ client = app.test_client()+ client.set_cookie(+ remote_access.SESSION_COOKIE_NAME,+ remote_session_cookie(config, "[email protected]", "user-owner"),+ domain="alex.avibe.bot",+ )++ async def unexpected_turn_state(session_id):+ raise AssertionError(f"remote fork reached turn-state lookup for {session_id}")++ monkeypatch.setattr(ui_server, "_session_turn_state_for_fork", unexpected_turn_state)+ monkeypatch.setattr(+ ui_server,+ "_reserve_forked_session_for_ui",+ lambda *args, **kwargs: (_ for _ in ()).throw(+ AssertionError("remote fork reached the local session store")+ ),+ )++ response = client.post(+ "/api/sessions/ses-local/fork",+ headers=csrf_headers(client, "https://alex.avibe.bot"),+ base_url="https://alex.avibe.bot",+ environ_base=_remote_peer(),+ )++ assert response.status_code == 403+ assert response.get_json()["code"] == "remote_execution_disabled"++@pytest.mark.parametrize("json_body",[@@ -1825,6 +1852,35 @@ def test_remote_show_dispatch_is_rejected_before_event_reservation(assert response.get_json()["code"] == "remote_execution_disabled"+def test_remote_show_runtime_write_is_rejected_before_runtime_invocation(+ monkeypatch,+ tmp_path,+):+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ config = _save_config(tmp_path)+ client = app.test_client()+ client.set_cookie(+ remote_access.SESSION_COOKIE_NAME,+ remote_session_cookie(config, "[email protected]", "user-owner"),+ domain="alex.avibe.bot",+ )++ async def unexpected_runtime(*args, **kwargs):+ raise AssertionError("remote Show write reached the local Show Runtime")++ monkeypatch.setattr(ui_server, "_show_page_runtime_response", unexpected_runtime)+ response = client.post(+ "/show/ses-remote/api/example",+ json={"input": "remote"},+ headers=csrf_headers(client, "https://alex.avibe.bot"),+ base_url="https://alex.avibe.bot",+ environ_base=_remote_peer(),+ )++ assert response.status_code == 403+ assert response.get_json()["code"] == "remote_execution_disabled"++def test_remote_owner_can_still_read_authorized_session_history(monkeypatch,tmp_path,diff --git a/vibe/authorization.py b/vibe/authorization.pyindex e29042196..453963160 100644--- a/vibe/authorization.py+++ b/vibe/authorization.py@@ -338,12 +338,16 @@ _REMOTE_LOCAL_ONLY_HTTP_RULES = tuple((method, re.compile(pattern))for method, pattern in (("DELETE", r"^/api/sessions/[^/]+(?:/queue/[^/]+)?$"),+ ("POST", r"^/api/sessions/[^/]+/fork$"),("POST",r"^/api/sessions/[^/]+/(?:messages|attachments|cancel|queue/[^/]+/send-now)$",),("POST", r"^/api/asr/transcribe$"),("POST", r"^/api/show/sessions/[^/]+/(?:events|prewarm)$"),+ ("POST", r"^/api/settings$"),+ ("POST", r"^/api/settings/thread$"),+ ("DELETE", r"^/api/settings/thread$"),))@@ -352,7 +356,7 @@ _REMOTE_PAYLOAD_FILTERED_HTTP_RULES = tuple(for method, pattern in (("POST",- r"^/api/(?:config|projects|sessions|settings|settings/thread)$",+ r"^/api/(?:config|projects|sessions)$",),("PATCH", r"^/api/(?:projects|sessions)/[^/]+$"),)@@ -463,7 +467,12 @@ def http_authorization_policy(method: str, path: str) -> HttpAuthorizationPolicyminimum_role = ("viewer" if normalized_method in {"GET", "HEAD", "OPTIONS"} else "editor")- return HttpAuthorizationPolicy(minimum_role)+ remote_access = (+ REMOTE_HTTP_ALLOWED+ if normalized_method in {"GET", "HEAD", "OPTIONS"}+ else REMOTE_HTTP_LOCAL_ONLY+ )+ return HttpAuthorizationPolicy(minimum_role, remote_access)if not path.startswith("/api/"):return HttpAuthorizationPolicy(None)diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 9a90e331d..4c21c0ff8 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -2256,21 +2256,8 @@ _REMOTE_UI_CONFIG_MUTABLE_FIELDS = frozenset("show_tool_calls",})-_REMOTE_CHANNEL_SETTING_FIELDS = frozenset(- {"enabled", "require_bind", "require_mention", "show_message_types"}-)-_REMOTE_SETTINGS_FIELDS = frozenset(- {- "channels",- "guild_allowlist",- "guild_default_enabled",- "guilds",- "platform",- }-)-_REMOTE_THREAD_SETTINGS_FIELDS = frozenset(- {"channel_id", "platform", "settings", "thread_id"}-)++def _payload_has_only_fields(payload: Any, fields: frozenset[str] | set[str]) -> bool:return isinstance(payload, dict) and set(payload).issubset(fields)@@ -2357,32 +2344,6 @@ def _remote_mutable_config_payload(payload: dict[str, Any]) -> dict[str, Any]:return mutable-def _remote_scope_collection_is_allowed(- payload: Any,- *,- item_fields: frozenset[str],-) -> bool:- return isinstance(payload, dict) and all(- _payload_has_only_fields(item, item_fields) for item in payload.values()- )---def _remote_settings_payload_is_allowed(payload: Any) -> bool:- if not _payload_has_only_fields(payload, _REMOTE_SETTINGS_FIELDS):- return False- if "channels" in payload and not _remote_scope_collection_is_allowed(- payload.get("channels"),- item_fields=_REMOTE_CHANNEL_SETTING_FIELDS,- ):- return False- if "guilds" in payload and not _remote_scope_collection_is_allowed(- payload.get("guilds"),- item_fields=frozenset({"enabled"}),- ):- return False- return True--def _remote_payload_is_allowed(method: str, path: str, payload: Any) -> bool:normalized_method = method.upper()if normalized_method == "POST" and path == "/api/config":@@ -2393,15 +2354,6 @@ def _remote_payload_is_allowed(method: str, path: str, payload: Any) -> bool:return _payload_has_only_fields(payload, {"pinned", "title", "visibility"})if normalized_method == "PATCH" and re.fullmatch(r"/api/projects/[^/]+", path):return _payload_has_only_fields(payload, {"display_name"})- if normalized_method == "POST" and path == "/api/settings":- return _remote_settings_payload_is_allowed(payload)- if normalized_method == "POST" and path == "/api/settings/thread":- if not _payload_has_only_fields(payload, _REMOTE_THREAD_SETTINGS_FIELDS):- return False- return _payload_has_only_fields(- payload.get("settings"),- _REMOTE_CHANNEL_SETTING_FIELDS,- )if normalized_method == "POST" and path == "/api/projects":return _payload_has_only_fields(payload, {"display_name"})return False