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 runtime boundaries

Max38c2d0dd41ac
diff --git a/tests/test_resource_acl_show_pages.py b/tests/test_resource_acl_show_pages.py
index 87e61c854..94d3bc312 100644
--- a/tests/test_resource_acl_show_pages.py
+++ b/tests/test_resource_acl_show_pages.py
@@ -940,6 +940,8 @@ def test_untrusted_dock_context_fails_closed(monkeypatch, tmp_path) -> None:
def test_remote_member_archive_is_denied_under_resource_acl(monkeypatch, tmp_path) -> None:
+ from unittest.mock import AsyncMock
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
config = _save_config(tmp_path)
project_dir = tmp_path / "project"
@@ -970,6 +972,12 @@ def test_remote_member_archive_is_denied_under_resource_acl(monkeypatch, tmp_pat
finally:
store.close()
+ archive_session = AsyncMock()
+ monkeypatch.setattr(
+ "vibe.internal_client.memory_archive_session",
+ archive_session,
+ )
+
# Show Page archive of another owner's page stays reserved to
# owner/admin Organization roles under the Resource ACL boundary
# (see #1343); a plain active Organization member is denied.
@@ -992,6 +1000,7 @@ def test_remote_member_archive_is_denied_under_resource_acl(monkeypatch, tmp_pat
)
assert response.status_code in {403, 404}
+ archive_session.assert_not_awaited()
with engine.connect() as connection:
assert connection.execute(
select(agent_sessions.c.status).where(agent_sessions.c.id == session_id)
diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsx
index d724fe47a..2ed45e5c3 100644
--- a/ui/src/components/AppShell.tsx
+++ b/ui/src/components/AppShell.tsx
@@ -37,7 +37,7 @@ import { getEnabledPlatforms, platformSupportsChannels } from '../lib/platforms'
import { useViewportHeightVar } from '../lib/useViewportHeightVar';
import {
adminLandingPath,
- filterLocalSystemNavItems,
+ filterRuntimeAccessNavItems,
isAdvancedSettingsPath,
isLocalSystemPathForAccess,
isMemorySettingsPath,
@@ -504,9 +504,9 @@ export const AppShell: React.FC = () => {
// must not still be advertised, or a remote owner taps a nav entry and lands
// back on the Workbench. With the temporary Organization rollout every admin
// surface except remote-access pairing is admitted, so the nav stays full.
- const visibleAdminItems = canUseRuntimeSurfaces || capabilities.can_use_system
+ const visibleAdminItems = capabilities.can_use_system
? adminItems
- : filterLocalSystemNavItems(adminItems);
+ : filterRuntimeAccessNavItems(adminItems, canUseRuntimeSurfaces);
const items: ShellNavItem[] = shellMode === 'admin' ? visibleAdminItems : [];
@@ -528,9 +528,9 @@ export const AppShell: React.FC = () => {
match: (pathname) => isAdvancedSettingsPath(pathname, memoryNavVisible),
},
];
- const adminMobileTabs = canUseRuntimeSurfaces || capabilities.can_use_system
+ const adminMobileTabs = capabilities.can_use_system
? adminMobileTabsAll
- : filterLocalSystemNavItems(adminMobileTabsAll);
+ : filterRuntimeAccessNavItems(adminMobileTabsAll, canUseRuntimeSurfaces);
// The More sheet shows the overflow: admin sections not already on the bottom
// bar. Keep its filtering aligned with the currently visible primary tabs.
const adminBottomBarPaths = new Set(
diff --git a/ui/src/lib/adminNavigation.test.ts b/ui/src/lib/adminNavigation.test.ts
index 9ad67a363..2c340639d 100644
--- a/ui/src/lib/adminNavigation.test.ts
+++ b/ui/src/lib/adminNavigation.test.ts
@@ -3,6 +3,7 @@ import { describe, expect, it } from 'vitest';
import {
adminLandingPath,
filterLocalSystemNavItems,
+ filterRuntimeAccessNavItems,
isAdvancedSettingsPath,
isLocalOnlyMessagingField,
isLocalSystemPath,
@@ -100,6 +101,33 @@ describe('filterLocalSystemNavItems', () => {
});
});
+describe('filterRuntimeAccessNavItems', () => {
+ const navItems = [
+ { to: '/admin/dashboard' },
+ {
+ children: [
+ { to: '/admin/remote-access' },
+ { to: '/admin/settings/models' },
+ ],
+ },
+ { to: '/admin/settings/messaging' },
+ ];
+
+ it('withholds only Remote Access during the temporary Organization rollout', () => {
+ expect(filterRuntimeAccessNavItems(navItems, true)).toEqual([
+ { to: '/admin/dashboard' },
+ { children: [{ to: '/admin/settings/models' }] },
+ { to: '/admin/settings/messaging' },
+ ]);
+ });
+
+ it('keeps the baseline local-system filter outside the temporary rollout', () => {
+ expect(filterRuntimeAccessNavItems(navItems, false)).toEqual([
+ { to: '/admin/settings/messaging' },
+ ]);
+ });
+});
+
describe('adminLandingPath', () => {
it('opens the Dashboard for a trusted-local caller', () => {
expect(adminLandingPath(true)).toBe('/admin/dashboard');
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index e0bd22da0..5651be207 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -9520,7 +9520,10 @@ async def sessions_archive(session_id: str):
writes into hidden history rather than re-surfacing the session.
"""
from core.services import sessions as workbench_sessions_service
+ from core.show_pages import ShowPageError, require_show_page_management
+ from sqlalchemy import select
from storage.agent_session_rows import WORKSPACE_NOTICE_SESSION_ID
+ from storage.models import show_pages
from vibe.sse_broker import broker
engine = _projects_engine()
@@ -9536,8 +9539,21 @@ async def sessions_archive(session_id: str):
session_id,
authorization_context=getattr(g, "authorization_context", None),
)
+ page_exists = conn.execute(
+ select(show_pages.c.session_id).where(
+ show_pages.c.session_id == session_id
+ )
+ ).scalar_one_or_none()
+ if page_exists is not None:
+ require_show_page_management(
+ conn,
+ session_id,
+ user_context=getattr(g, "authorization_context", None),
+ )
except LookupError as err:
return jsonify({"error": str(err)}), 404
+ except ShowPageError as err:
+ return _coded_error_response(err.code, str(err), 403)
if existing_session.get("status") == "archived":
try:
with engine.begin() as conn: