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(auth): preserve remote owner memory access

cyhb3d5a26a7d02
diff --git a/tests/test_instance_authorization.py b/tests/test_instance_authorization.py
index 778c5ad0f..807d137d6 100644
--- a/tests/test_instance_authorization.py
+++ b/tests/test_instance_authorization.py
@@ -169,6 +169,8 @@ def test_http_policy_defaults_unknown_api_to_owner() -> None:
("GET", "/api/bind-codes/future-capability"),
("GET", "/api/future-owner-capability"),
("POST", "/api/future-owner-capability"),
+ ("GET", "/api/memory/future-capability"),
+ ("POST", "/api/memory/future-capability"),
],
)
def test_remote_http_policy_defaults_local_machine_and_unknown_routes_to_local_only(
@@ -204,6 +206,12 @@ def test_remote_http_policy_defaults_local_machine_and_unknown_routes_to_local_o
("POST", "/api/show-pages/ses-1/rotate-share", REMOTE_HTTP_LOCAL_ONLY),
("POST", "/api/show-pages/ses-1/share-id", REMOTE_HTTP_LOCAL_ONLY),
("POST", "/api/show-pages/ses-1/ensure", REMOTE_HTTP_ALLOWED),
+ ("GET", "/api/memory/settings", REMOTE_HTTP_ALLOWED),
+ ("HEAD", "/api/memory/log/entry", REMOTE_HTTP_ALLOWED),
+ ("PATCH", "/api/memory/settings", REMOTE_HTTP_ALLOWED),
+ ("POST", "/api/memory/search", REMOTE_HTTP_ALLOWED),
+ ("POST", "/api/memory/runtime/restart", REMOTE_HTTP_ALLOWED),
+ ("POST", "/api/memory/clear", REMOTE_HTTP_ALLOWED),
("GET", "/show/ses-1/", REMOTE_HTTP_ALLOWED),
("POST", "/show/ses-1/__show/events", REMOTE_HTTP_ALLOWED),
("POST", "/api/config", REMOTE_HTTP_PAYLOAD_FILTERED),
diff --git a/tests/test_ui_memory_routes.py b/tests/test_ui_memory_routes.py
index 726eceba0..03ab7c145 100644
--- a/tests/test_ui_memory_routes.py
+++ b/tests/test_ui_memory_routes.py
@@ -16,7 +16,7 @@ from config.v2_config import (
SlackConfig,
V2Config,
)
-from tests.ui_server_test_helpers import csrf_headers
+from tests.ui_server_test_helpers import csrf_headers, remote_session_cookie
from vibe import api, internal_client, remote_access, ui_memory_routes, ui_server
from vibe.ui_server import app
@@ -58,6 +58,10 @@ def _renewable_remote_session_cookie(
"instance_id": config.remote_access.vibe_cloud.instance_id,
"iat": expires_at - remote_access.SESSION_TTL_SECONDS,
"exp": expires_at,
+ "claims_issued_at": int(time.time()),
+ "vibe_instance_id": config.remote_access.vibe_cloud.instance_id,
+ "vibe_instance_role": "owner",
+ "vibe_instance_access_source": "owner",
}
payload_text = urllib.parse.quote(json.dumps(payload, separators=(",", ":")), safe="")
signature = remote_access._session_signature(
@@ -139,7 +143,7 @@ def test_memory_authenticated_avibe_cloud_uses_the_remote_workbench_principal(
client = app.test_client()
client.set_cookie(
remote_access.SESSION_COOKIE_NAME,
- remote_access.make_session_cookie(config, "[email protected]", "user-1"),
+ remote_session_cookie(config, "[email protected]", "user-1"),
domain="alex.avibe.bot",
)
remote_headers = {"Origin": "https://alex.avibe.bot"}
@@ -180,7 +184,7 @@ def test_memory_diagnostics_patch_is_rejected_for_remote_ui(monkeypatch, tmp_pat
client = app.test_client()
client.set_cookie(
remote_access.SESSION_COOKIE_NAME,
- remote_access.make_session_cookie(config, "[email protected]", "user-1"),
+ remote_session_cookie(config, "[email protected]", "user-1"),
domain="alex.avibe.bot",
)
calls: list[bool] = []
@@ -235,7 +239,7 @@ def test_memory_avibe_cloud_read_still_requires_same_origin(monkeypatch, tmp_pat
client = app.test_client()
client.set_cookie(
remote_access.SESSION_COOKIE_NAME,
- remote_access.make_session_cookie(config, "[email protected]", "user-1"),
+ remote_session_cookie(config, "[email protected]", "user-1"),
domain="alex.avibe.bot",
)
diff --git a/vibe/authorization.py b/vibe/authorization.py
index 091e7326c..fcc33869a 100644
--- a/vibe/authorization.py
+++ b/vibe/authorization.py
@@ -447,6 +447,15 @@ _REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple(
frozenset({"GET", "HEAD"}),
r"^/api/harness/counts$",
),
+ (
+ frozenset({"GET", "HEAD"}),
+ r"^/api/memory/(?:settings|status|failures|profile|log|log/entry)$",
+ ),
+ (frozenset({"PATCH"}), r"^/api/memory/settings$"),
+ (
+ frozenset({"POST"}),
+ r"^/api/memory/(?:search|runtime/restart|clear)$",
+ ),
)
)