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): allow role-safe preference reads

Maxvinta396913e025e
diff --git a/tests/test_instance_authorization.py b/tests/test_instance_authorization.py
index 9cf76f886..0e7929dd3 100644
--- a/tests/test_instance_authorization.py
+++ b/tests/test_instance_authorization.py
@@ -61,6 +61,8 @@ def test_http_policy_defaults_unknown_api_to_owner() -> None:
assert required_instance_role("GET", "/api/projects/proj-1/agents-md") == "owner"
assert required_instance_role("GET", "/api/agents") == "editor"
assert required_instance_role("GET", "/api/config") == "viewer"
+ assert required_instance_role("GET", "/api/workbench/prefs") == "viewer"
+ assert required_instance_role("PUT", "/api/workbench/prefs") == "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/projects") == "owner"
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 3bbc88390..3282bc66e 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -724,6 +724,13 @@ def test_remote_instance_role_route_matrix(
read_response = client.get("/api/projects", base_url="https://alex.avibe.bot")
agents_response = client.get("/api/agents", base_url="https://alex.avibe.bot")
config_response = client.get("/api/config", base_url="https://alex.avibe.bot")
+ prefs_read_response = client.get("/api/workbench/prefs", base_url="https://alex.avibe.bot")
+ prefs_write_response = client.put(
+ "/api/workbench/prefs",
+ base_url="https://alex.avibe.bot",
+ headers=headers,
+ json={"background_work_banner_enabled": False},
+ )
conversation_response = client.post(
"/api/sessions",
base_url="https://alex.avibe.bot",
@@ -740,6 +747,9 @@ def test_remote_instance_role_route_matrix(
assert read_response.status_code == 200
assert agents_response.status_code == agents_status
assert config_response.status_code == 200
+ assert prefs_read_response.status_code == 200
+ assert prefs_read_response.get_json()["background_work_banner_enabled"] is True
+ assert prefs_write_response.status_code == (200 if role == "owner" else 403)
if role == "owner":
assert "runtime" in config_response.get_json()
else:
diff --git a/vibe/authorization.py b/vibe/authorization.py
index b50fd9151..a690f5dca 100644
--- a/vibe/authorization.py
+++ b/vibe/authorization.py
@@ -212,6 +212,7 @@ _VIEWER_HTTP_RULES = tuple(
r"^/api/version$",
r"^/api/platforms$",
r"^/api/projects(?:/[^/]+)?$",
+ r"^/api/workbench/prefs$",
r"^/api/workbench/projects-bootstrap$",
r"^/api/sessions$",
r"^/api/sessions/[^/]+$",