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): keep local execution mutations trusted-local
Max7c6f64be17b3
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 4c803a53c..9a11b819b 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@@ -78,6 +78,8 @@ substitute for either dependency.- Remote Workbench message and Show dispatch do not reserve or start a turn.- Remote terminal and file requests fail closed; trusted-local requests retainexisting behavior.+- Remote Vault secret/grant/sign mutations, IM user and bind-code mutations, and+ Skill source previews fail before reaching local stores or tooling.- Remote service control, installers, Agent-definition mutations, model/backendmutations and probes, and Show Page icon writes fail before reaching theirlocal runtime or filesystem services.diff --git a/tests/test_instance_authorization.py b/tests/test_instance_authorization.pyindex 0e2b3c137..8805b26ef 100644--- a/tests/test_instance_authorization.py+++ b/tests/test_instance_authorization.py@@ -129,6 +129,17 @@ def test_http_policy_defaults_unknown_api_to_owner() -> None:("POST", "/api/ui/reload"),("POST", "/api/opencode/options"),("POST", "/api/opencode/setup-permission"),+ ("POST", "/api/vault/secrets"),+ ("PATCH", "/api/vault/secrets/secret-1"),+ ("DELETE", "/api/vault/grants/grant-1"),+ ("POST", "/api/vault/grants"),+ ("POST", "/api/vault/sign"),+ ("POST", "/api/skills/preview"),+ ("POST", "/api/users"),+ ("POST", "/api/users/user-1/admin"),+ ("DELETE", "/api/users/user-1"),+ ("POST", "/api/bind-codes"),+ ("DELETE", "/api/bind-codes/code-1"),("GET", "/api/vault/future-capability"),("GET", "/api/dock/future-capability"),("GET", "/api/web-push/future-capability"),@@ -164,8 +175,8 @@ def test_remote_http_policy_defaults_local_machine_and_unknown_routes_to_local_o("POST", "/api/dock/pins", REMOTE_HTTP_ALLOWED),("POST", "/api/web-push/subscriptions", REMOTE_HTTP_ALLOWED),("GET", "/api/harness/runs/run-1", REMOTE_HTTP_ALLOWED),- ("POST", "/api/users/user-1/admin", REMOTE_HTTP_ALLOWED),- ("DELETE", "/api/bind-codes/code-1", REMOTE_HTTP_ALLOWED),+ ("GET", "/api/users", REMOTE_HTTP_ALLOWED),+ ("GET", "/api/bind-codes", 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),diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.pyindex c46351f1a..ea89aa5e9 100644--- a/tests/test_ui_remote_access_auth.py+++ b/tests/test_ui_remote_access_auth.py@@ -1498,6 +1498,7 @@ def test_remote_agent_definition_mutations_are_blocked_before_api_calls(@pytest.mark.parametrize(("method", "path", "json_body", "api_method"),[+ ("POST", "/api/skills/preview", {"source": "./local-skill"}, "preview_skill_source"),("POST", "/api/skills", {"source": "gh:owner/repo"}, "add_skill"),("POST", "/api/skills/update", {"name": "demo"}, "update_skill"),("POST", "/api/skills/upload", {"content_base64": ""}, "upload_skill_zip"),@@ -1538,6 +1539,134 @@ def test_remote_skill_mutations_are_blocked_before_api_calls(assert response.get_json()["code"] == "remote_execution_disabled"+ ("method", "path", "json_body", "api_method"),+ [+ ("POST", "/api/vault/secrets", {"name": "REMOTE_SECRET"}, "create_vault_secret"),+ ("PATCH", "/api/vault/secrets/REMOTE_SECRET", {"description": "changed"}, "update_vault_secret"),+ ("DELETE", "/api/vault/secrets/REMOTE_SECRET", None, "delete_vault_secret"),+ ("POST", "/api/vault/grants", {"secret_name": "REMOTE_SECRET"}, "create_vault_grant"),+ ("DELETE", "/api/vault/grants/grant-1", None, "revoke_vault_grant"),+ ("POST", "/api/vault/sign", {"secret_name": "REMOTE_SECRET"}, "vault_sign"),+ ],+)+def test_remote_vault_mutations_are_blocked_before_api_calls(+ monkeypatch,+ tmp_path,+ method,+ path,+ json_body,+ api_method,+):+ 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",+ )++ def unexpected_vault_call(*args, **kwargs):+ raise AssertionError("remote Vault mutation reached the local Vault API")++ monkeypatch.setattr(api, api_method, unexpected_vault_call)+ response = client.request(+ method,+ path,+ json=json_body,+ 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"+++ ("method", "path", "json_body", "api_method"),+ [+ ("POST", "/api/users", {"platform": "slack", "users": {"U1": {"enabled": True}}}, "save_users"),+ ("POST", "/api/users/U1/admin", {"platform": "slack", "is_admin": True}, "toggle_admin"),+ ("DELETE", "/api/users/U1", None, "remove_user"),+ ],+)+def test_remote_im_user_mutations_are_blocked_before_api_calls(+ monkeypatch,+ tmp_path,+ method,+ path,+ json_body,+ api_method,+):+ 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",+ )++ def unexpected_user_call(*args, **kwargs):+ raise AssertionError("remote IM user mutation reached the local user store")++ monkeypatch.setattr(api, api_method, unexpected_user_call)+ response = client.request(+ method,+ path,+ json=json_body,+ 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"+++ ("method", "path", "json_body", "api_method"),+ [+ ("POST", "/api/bind-codes", {"type": "one_time"}, "create_bind_code"),+ ("DELETE", "/api/bind-codes/CODE1", None, "delete_bind_code"),+ ],+)+def test_remote_bind_code_mutations_are_blocked_before_api_calls(+ monkeypatch,+ tmp_path,+ method,+ path,+ json_body,+ api_method,+):+ 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",+ )++ def unexpected_bind_code_call(*args, **kwargs):+ raise AssertionError("remote bind-code mutation reached the local auth store")++ monkeypatch.setattr(api, api_method, unexpected_bind_code_call)+ response = client.request(+ method,+ path,+ json=json_body,+ 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(("path", "json_body", "write_target"),[@@ -1659,7 +1788,7 @@ def test_remote_owner_can_still_read_agent_instructions_and_queue(assert global_response.get_json() == {"backends": []}assert queue_response.status_code == 200assert queue_response.get_json() == {"queued": []}- assert not ui_server._is_remote_local_execution_request("POST", "/api/skills/preview")+ assert ui_server._is_remote_local_execution_request("POST", "/api/skills/preview")def test_remote_show_dispatch_is_rejected_before_event_reservation(diff --git a/vibe/authorization.py b/vibe/authorization.pyindex 655590db1..e29042196 100644--- a/vibe/authorization.py+++ b/vibe/authorization.py@@ -352,12 +352,15 @@ _REMOTE_PAYLOAD_FILTERED_HTTP_RULES = tuple(for method, pattern in (("POST",- r"^/api/(?:config|projects|sessions|settings|settings/thread|users)$",+ r"^/api/(?:config|projects|sessions|settings|settings/thread)$",),("PATCH", r"^/api/(?:projects|sessions)/[^/]+$"),))+# Positive allowlist for remote-safe owner surfaces. Any route that mutates+# local Agent, IM, Vault, or other execution state must stay absent here and+# therefore use the fail-closed local-only default below._REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple((methods, re.compile(pattern))for methods, pattern in (@@ -370,18 +373,6 @@ _REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple(frozenset({"GET", "HEAD"}),r"^/api/vault/(?:pubkey|agent/pubkey|sandbox/root-metadata|settings|vmk|requests|requests/[^/]+|provision-requests/[^/]+|provision-requests/by-id/[^/]+|grants|audit)$",),- (- frozenset({"POST"}),- r"^/api/vault/(?:agent-bindings:batch|agent-binding|authz/factors/webauthn/options|authz/factors/webauthn|signing-addresses|secrets|secrets/[^/]+/reveal-context|requests/[^/]+/deny|requests/[^/]+/fulfill-access|grants|sign|pubkey-pin)$",- ),- (- frozenset({"PATCH"}),- r"^/api/vault/(?:settings|secrets/[^/]+)$",- ),- (- frozenset({"DELETE"}),- r"^/api/vault/(?:secrets/[^/]+|grants/[^/]+)$",- ),(frozenset({"POST"}),r"^/api/show-pages/[^/]+/(?:ensure|rotate-share|share-id|visibility)$",@@ -409,7 +400,6 @@ _REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple(frozenset({"GET", "HEAD"}),r"^/api/(?:projects/[^/]+/agents-md|global-prompts)$",),- (frozenset({"POST"}), r"^/api/skills/preview$"),(frozenset({"GET", "HEAD"}), r"^/api/skills/(?:check|find)$"),(frozenset({"GET", "HEAD"}),@@ -436,10 +426,7 @@ _REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple(r"^/api/harness/(?:counts|tasks|watches|runs|bootstrap|runs/[^/]+)$",),(frozenset({"GET", "HEAD"}), r"^/api/users$"),- (frozenset({"POST"}), r"^/api/users/[^/]+/admin$"),- (frozenset({"DELETE"}), r"^/api/users/[^/]+$"),- (frozenset({"GET", "HEAD", "POST"}), r"^/api/bind-codes$"),- (frozenset({"DELETE"}), r"^/api/bind-codes/[^/]+$"),+ (frozenset({"GET", "HEAD"}), r"^/api/bind-codes$"),))diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 7eef278c9..7dde377f2 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -2271,17 +2271,6 @@ _REMOTE_SETTINGS_FIELDS = frozenset(_REMOTE_THREAD_SETTINGS_FIELDS = frozenset({"channel_id", "platform", "settings", "thread_id"})-_REMOTE_USER_SETTING_FIELDS = frozenset(- {- "bound_at",- "display_name",- "enabled",- "is_admin",- "show_message_types",- }-)--def _payload_has_only_fields(payload: Any, fields: frozenset[str] | set[str]) -> bool:return isinstance(payload, dict) and set(payload).issubset(fields)@@ -2413,13 +2402,6 @@ def _remote_payload_is_allowed(method: str, path: str, payload: Any) -> bool:payload.get("settings"),_REMOTE_CHANNEL_SETTING_FIELDS,)- if normalized_method == "POST" and path == "/api/users":- if not _payload_has_only_fields(payload, {"platform", "users"}):- return False- return _remote_scope_collection_is_allowed(- payload.get("users"),- item_fields=_REMOTE_USER_SETTING_FIELDS,- )if normalized_method == "POST" and path == "/api/projects":return _payload_has_only_fields(payload, {"display_name"})return False