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(acl): enforce current org membership
Maxvint7cf02ba3d120
diff --git a/core/show_pages.py b/core/show_pages.pyindex 002d45706..de0071d36 100644--- a/core/show_pages.py+++ b/core/show_pages.py@@ -507,9 +507,9 @@ class ShowPageStore:raise ShowPageError(f"Unsupported visibility: {visibility}", code="invalid_visibility")existing = self.get(session_id)if existing is not None:- # Check access before reporting a terminal lifecycle state so an+ # Check management before reporting a terminal lifecycle state so an# unauthorized remote user cannot probe page/session details.- page = self.ensure(session_id, user_context=context)+ page = self.require_management(session_id, user_context=context)else:page = None# Reject republish BEFORE ``ensure`` so it doesn't first materialize a@@ -556,7 +556,7 @@ class ShowPageStore:context = _resolve_resource_access_context(user_context)existing = self.get(session_id)if existing is not None:- page = self.ensure(session_id, user_context=context)+ page = self.require_management(session_id, user_context=context)else:page = None# Same guard as update_visibility, before ``ensure`` materializes a page:@@ -608,7 +608,7 @@ class ShowPageStore:new_share_id = validate_share_id(share_id)existing = self.get(session_id)if existing is not None:- self.ensure(session_id, user_context=context)+ self.require_management(session_id, user_context=context)# Pre-guard before ``ensure`` so a stale/direct call never materializes a# default page for an archived (terminal) session. The in-txn re-reads# below are the atomic authority for the concurrent-archive / concurrentdiff --git a/storage/resource_access_service.py b/storage/resource_access_service.pyindex 29da41e45..2a149bbab 100644--- a/storage/resource_access_service.py+++ b/storage/resource_access_service.py@@ -578,7 +578,13 @@ def _policy_allows(context: ResourceUserContext, policy: Mapping[str, Any] | Nonowner_user_id = _clean_optional_string(policy.get("owner_user_id"))if policy.get("access_level") == "private":- return bool(owner_user_id and context.subject and owner_user_id == context.subject)+ if not (owner_user_id and context.subject and owner_user_id == context.subject):+ return False+ organization_id = _clean_optional_string(policy.get("organization_id"))+ return bool(+ not organization_id+ or context.is_active_organization_member and context.organization_id == organization_id+ )organization_id = _clean_optional_string(policy.get("organization_id"))if not organization_id or context.organization_id != organization_id or not context.is_active_organization_member:@@ -600,7 +606,11 @@ def _policy_allows_management(context: ResourceUserContext, policy: Mapping[str,return context.is_instance_ownerowner_user_id = _clean_optional_string(policy.get("owner_user_id"))if owner_user_id and context.subject and owner_user_id == context.subject:- return True+ organization_id = _clean_optional_string(policy.get("organization_id"))+ return bool(+ not organization_id+ or context.is_active_organization_member and context.organization_id == organization_id+ )return bool(context.is_active_organization_memberand context.organization_id == _clean_optional_string(policy.get("organization_id"))diff --git a/tests/test_resource_access_service.py b/tests/test_resource_access_service.pyindex 165546ce5..13b0d610b 100644--- a/tests/test_resource_access_service.py+++ b/tests/test_resource_access_service.py@@ -117,6 +117,56 @@ def test_no_policy_is_local_private_but_instance_owner_keeps_legacy_access(tmp_pengine.dispose()+def test_removed_org_owner_loses_org_private_resources_but_keeps_personal_resources(tmp_path) -> None:+ db = tmp_path / "vibe.sqlite"+ run_migrations(db)+ engine = create_sqlite_engine(db)+ try:+ with engine.begin() as connection:+ _seed_policies(connection)+ resource_access_service.ensure_resource_policy(+ connection,+ resource_kind="agent",+ resource_id="personal-agent",+ organization_id=None,+ owner_user_id="owner-1",+ access_level="private",+ )+ removed_owner = _context(+ "owner-1",+ organization_id=None,+ role=None,+ access_source="email_invitation",+ )++ assert not resource_access_service.can_use_resource(+ removed_owner,+ "agent",+ "private-agent",+ connection=connection,+ )+ assert not resource_access_service.can_manage_resource_acl(+ removed_owner,+ "agent",+ "private-agent",+ connection=connection,+ )+ assert resource_access_service.can_use_resource(+ removed_owner,+ "agent",+ "personal-agent",+ connection=connection,+ )+ assert resource_access_service.can_manage_resource_acl(+ removed_owner,+ "agent",+ "personal-agent",+ connection=connection,+ )+ finally:+ engine.dispose()++def test_request_context_resolution_failure_does_not_become_trusted_local(monkeypatch) -> None:from vibe.ui_server import appdiff --git a/tests/test_resource_acl_show_pages.py b/tests/test_resource_acl_show_pages.pyindex 7209db856..b57b920f9 100644--- a/tests/test_resource_acl_show_pages.py+++ b/tests/test_resource_acl_show_pages.py@@ -190,6 +190,33 @@ def test_show_page_scope_without_group_context_fails_closed(monkeypatch, tmp_patassert excinfo.value.code == "resource_access_forbidden"+def test_remote_admin_can_manage_pages_without_use_access(monkeypatch, tmp_path) -> None:+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ store = _seed_show_pages_with_policies()+ admin = _organization_context(+ "admin-1",+ group_ids=frozenset({"group-sales"}),+ organization_role="admin",+ )+ try:+ with pytest.raises(ShowPageError, match="Show Page access is not permitted"):+ store.require_access("ses-private", user_context=admin)+ private_page = store.update_visibility("ses-private", "public", user_context=admin)+ rotated, previous_share_id = store.rotate_share("ses-private", user_context=admin)+ custom, rotated_share_id = store.set_share_id("ses-private", "admin-link", user_context=admin)++ assert private_page.visibility == "public"+ assert previous_share_id == private_page.share_id+ assert rotated_share_id == rotated.share_id+ assert custom.share_id == "admin-link"++ with pytest.raises(ShowPageError, match="Show Page access is not permitted"):+ store.require_access("ses-scope", user_context=admin)+ assert store.update_visibility("ses-scope", "offline", user_context=admin).visibility == "offline"+ finally:+ store.close()++def test_remote_dock_filters_private_pins_and_authorizes_mutations(monkeypatch, tmp_path) -> None:monkeypatch.setenv("AVIBE_HOME", str(tmp_path))config = _save_config(tmp_path)