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(show-pages): address authorization review
Max23a26e81aebf
diff --git a/core/show_pages.py b/core/show_pages.pyindex 5712a3831..6cb860061 100644--- a/core/show_pages.py+++ b/core/show_pages.py@@ -443,6 +443,24 @@ class ShowPageStore:def _require_access_management(connection, session_id: str, user_context: Any) -> None:require_show_page_access_management(connection, session_id, user_context=user_context)+ @classmethod+ def _require_visibility_transition_control(+ cls,+ connection,+ session_id: str,+ user_context: Any,+ *,+ current_visibility: str,+ target_visibility: str,+ ) -> None:+ if target_visibility == VISIBILITY_PUBLIC or (+ current_visibility == VISIBILITY_OFFLINE+ and target_visibility != VISIBILITY_OFFLINE+ ):+ cls._require_sharing_control(connection, session_id, user_context)+ return+ cls._require_access_management(connection, session_id, user_context)+@staticmethoddef _require_create_access(user_context: Any) -> None:if user_context.can_manage_instance:@@ -591,14 +609,15 @@ class ShowPageStore:if existing is not None:# Check management before reporting a terminal lifecycle state so an# unauthorized remote user cannot probe page/session details.- if visibility == VISIBILITY_PUBLIC:- with self.engine.connect() as conn:- self._require_sharing_control(conn, session_id, context)- page = existing- else:- with self.engine.connect() as conn:- self._require_access_management(conn, session_id, context)- page = existing+ with self.engine.connect() as conn:+ self._require_visibility_transition_control(+ conn,+ session_id,+ context,+ current_visibility=existing.visibility,+ target_visibility=visibility,+ )+ page = existingelse:page = None# Reject republish BEFORE ``ensure`` so it doesn't first materialize a@@ -621,10 +640,18 @@ class ShowPageStore:if visibility == VISIBILITY_PUBLIC and not page.share_id:values["share_id"] = self._unique_share_id()with self.engine.begin() as conn:- if visibility == VISIBILITY_PUBLIC:- self._require_sharing_control(conn, session_id, context)- else:- self._require_access_management(conn, session_id, context)+ current_visibility = conn.execute(+ select(show_pages.c.visibility).where(show_pages.c.session_id == session_id)+ ).scalar_one()+ # Re-evaluate against the in-transaction row so a concurrent transition+ # to offline cannot turn an access-manager operation into a republish.+ self._require_visibility_transition_control(+ conn,+ session_id,+ context,+ current_visibility=current_visibility,+ target_visibility=visibility,+ )# Archive is terminal and takes the page offline on purpose — never let# an archived session's page be brought back online / re-shared. Checked# in the SAME txn as the write so a concurrent archive can't slip indiff --git a/tests/test_instance_authorization.py b/tests/test_instance_authorization.pyindex 2cee48303..30e494627 100644--- a/tests/test_instance_authorization.py+++ b/tests/test_instance_authorization.py@@ -96,7 +96,7 @@ def test_http_policy_defaults_unknown_api_to_owner() -> None:assert required_instance_role("POST", "/api/show-pages/ses-1/visibility") == "viewer"assert required_instance_role("POST", "/api/show-pages/ses-1/rotate-share") == "viewer"assert required_instance_role("POST", "/api/show-pages/ses-1/share-id") == "viewer"- assert required_instance_role("POST", "/api/show-pages/ses-1/ensure") == "owner"+ assert required_instance_role("POST", "/api/show-pages/ses-1/ensure") == "viewer"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"diff --git a/tests/test_remote_resource_acl_sync.py b/tests/test_remote_resource_acl_sync.pyindex 12b4be731..c52f9bcba 100644--- a/tests/test_remote_resource_acl_sync.py+++ b/tests/test_remote_resource_acl_sync.py@@ -492,7 +492,7 @@ def test_malformed_intent_keeps_empty_organization_queued_for_retry(monkeypatch)assert resource_access_service.list_resource_organization_ids() == ["org-1"]-def test_acl_narrowing_publishes_one_authorization_change_for_all_resource_caches(monkeypatch) -> None:+def test_applied_acl_changes_publish_one_authorization_change_for_all_resource_caches(monkeypatch) -> None:paths.ensure_data_dirs()run_migrations()engine = get_cached_sqlite_engine()@@ -570,6 +570,69 @@ def test_acl_narrowing_publishes_one_authorization_change_for_all_resource_cache]+def test_show_page_acl_widening_publishes_authorization_change(monkeypatch) -> None:+ paths.ensure_data_dirs()+ run_migrations()+ engine = get_cached_sqlite_engine()+ with engine.begin() as connection:+ resource_access_service.ensure_resource_policy(+ connection,+ resource_kind="show_page",+ resource_id="show-page-widening",+ organization_id="org-1",+ owner_user_id="owner-1",+ access_level="private",+ policy_revision=1,+ last_applied_control_plane_revision=1,+ )+ monkeypatch.setattr(+ remote_access,+ "publish_resource_index",+ lambda *_args, **_kwargs: {"organization_id": "org-1", "resources": []},+ )+ monkeypatch.setattr(+ remote_access,+ "pull_resource_acl_intents",+ lambda *_args, **_kwargs: {+ "organization_id": "org-1",+ "intents": [+ {+ "resource_kind": "show_page",+ "resource_id": "show-page-widening",+ "revision": 2,+ "access_level": "public",+ "group_ids": [],+ }+ ],+ },+ )+ monkeypatch.setattr(+ remote_access,+ "acknowledge_resource_acl_intent",+ lambda *_args, **_kwargs: {},+ )+ events: list[tuple[str, dict[str, Any]]] = []+ monkeypatch.setattr(+ "vibe.sse_broker.broker.publish",+ lambda event_type, data: events.append((event_type, data)),+ )++ result = remote_access._sync_one_organization(+ _config(),+ organization_id="org-1",+ resources=[],+ )++ assert result["ok"] is True+ assert result["applied"] == 1+ assert events == [+ (+ "authorization.changed",+ {"project_ids": [], "resource_kinds": ["show_page"]},+ )+ ]++def test_transient_apply_failure_leaves_intent_unacknowledged(monkeypatch) -> None:_seed_policy()config = _config()diff --git a/tests/test_resource_acl_show_pages.py b/tests/test_resource_acl_show_pages.pyindex 4f4ec6cb2..e3962f587 100644--- a/tests/test_resource_acl_show_pages.py+++ b/tests/test_resource_acl_show_pages.py@@ -244,8 +244,45 @@ def test_remote_organization_admin_can_restrict_pages_without_use_access(monkeypwith 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"+ with pytest.raises(ShowPageError, match="Show Page access is not permitted"):+ store.update_visibility("ses-scope", "private", user_context=admin)+ restored = store.update_visibility(+ "ses-scope",+ "private",+ user_context=_organization_context("owner-1", instance_role="viewer"),+ )+ assert restored.visibility == "private"+ finally:+ store.close()+++def test_access_only_manager_visibility_response_does_not_expose_page_payload(monkeypatch, tmp_path) -> None:+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ _save_config(tmp_path)+ store = _seed_show_pages_with_policies()+ admin = _organization_context(+ "admin-1",+ group_ids=frozenset({"group-sales"}),+ organization_role="admin",+ instance_role="viewer",+ )+ try:+ store.update_visibility(+ "ses-private",+ "public",+ user_context=_organization_context("owner-1", instance_role="viewer"),+ )finally:store.close()+ monkeypatch.setattr(+ resource_access_service,+ "resolve_resource_access_context",+ lambda _value=None: admin,+ )++ result = api.set_show_page_visibility("ses-private", "private")++ assert result == {"ok": True, "public_link_enabled": False}def test_remote_show_page_owner_can_control_sharing_without_instance_owner_role(monkeypatch, tmp_path) -> None:@@ -309,6 +346,11 @@ def test_remote_show_page_owner_mutations_reach_resource_acl_as_viewer(monkeypat"environ_base": _remote_peer(),}+ ensured = client.post(+ f"/api/show-pages/{session_id}/ensure",+ json={},+ **request_options,+ )published = client.post(f"/api/show-pages/{session_id}/visibility",json={"visibility": "public"},@@ -325,6 +367,8 @@ def test_remote_show_page_owner_mutations_reach_resource_acl_as_viewer(monkeypat**request_options,)+ assert ensured.status_code == 200+ assert ensured.get_json()["existed"] is Trueassert published.status_code == 200assert rotated.status_code == 200assert customized.status_code == 200diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsxindex 035de5f90..8d786a57c 100644--- a/ui/src/components/workbench/ChatPage.tsx+++ b/ui/src/components/workbench/ChatPage.tsx@@ -164,6 +164,7 @@ export const ChatPage: React.FC = () => {sessionId: string;access: ShowPageAccess | null;} | null>(null);+ const showPageAccessProbeGenerationRef = useRef(0);const showPageAccess = capabilities.can_use_show_pages&& showPageAccessResult?.sessionId === sessionId? showPageAccessResult?.access ?? null@@ -217,18 +218,24 @@ export const ChatPage: React.FC = () => {// show the stale enabled/mode and could send control messages to the freshly// remounted overlay before it rebroadcasts. Re-points reset via the URL change.const annotation = useShowPageAnnotation(showPageMode ? showPageUrl : null);+ const probeShowPageAccess = useCallback(async (targetSessionId: string) => {+ const generation = ++showPageAccessProbeGenerationRef.current;+ try {+ const nextAccess = await api.probeShowPageAccess(targetSessionId);+ if (generation !== showPageAccessProbeGenerationRef.current) return;+ setShowPageAccessResult({ sessionId: targetSessionId, access: nextAccess });+ } catch {+ if (generation !== showPageAccessProbeGenerationRef.current) return;+ setShowPageAccessResult({ sessionId: targetSessionId, access: null });+ }+ }, [api]);useEffect(() => {- let cancelled = false;if (!sessionId || !capabilities.can_use_show_pages) return undefined;- void api.probeShowPageAccess(sessionId).then((nextAccess) => {- if (!cancelled) setShowPageAccessResult({ sessionId, access: nextAccess });- }).catch(() => {- if (!cancelled) setShowPageAccessResult({ sessionId, access: null });- });+ void probeShowPageAccess(sessionId);return () => {- cancelled = true;+ showPageAccessProbeGenerationRef.current += 1;};- }, [api, capabilities.can_use_show_pages, sessionId]);+ }, [capabilities.can_use_show_pages, probeShowPageAccess, sessionId]);useEffect(() => {// ChatPage is reused across :sessionId — clear all show-page state so the@@ -1127,9 +1134,12 @@ export const ChatPage: React.FC = () => {void syncTurnState({ quiet: true });void refreshSessionRowUntilNativeBound();},- onAuthorizationChanged: () => {+ onAuthorizationChanged: (data) => {const currentSessionId = sessionIdRef.current;if (!currentSessionId) return;+ if (data.resource_kinds?.includes('show_page')) {+ void probeShowPageAccess(currentSessionId);+ }setSessionCanChat(false);void api.getSession(currentSessionId, { cache: false }).then((nextSession) => {@@ -1149,7 +1159,7 @@ export const ChatPage: React.FC = () => {},});return disconnect;- }, [api, sessionId, appendMessage, reconcile, refresh, refreshQueue, syncTurnState, refreshSessionRowUntilNativeBound, markWorking, goBack, ingestActivityRow, scheduleActivityRefresh, dispatchLive]);+ }, [api, sessionId, appendMessage, reconcile, refresh, refreshQueue, syncTurnState, refreshSessionRowUntilNativeBound, markWorking, goBack, ingestActivityRow, scheduleActivityRefresh, dispatchLive, probeShowPageAccess]);// Mobile tabs (the common case for IM users) get backgrounded mid-turn; the// SSE feed can be suspended without a clean reconnect, dropping the reply.@@ -2494,6 +2504,7 @@ const ChatHeaderBar: React.FC<ChatHeaderBarProps> = ({ session, agents, defaultA</Button>}{canManageShowPage && (showPageMode || showPageAccess) && (<ShowPageShareControl+ key={session.id}sessionId={session.id}initialAccess={showPageAccess}onPayloadChange={onShowPageVisibilityChange}diff --git a/ui/src/components/workbench/ShowPageShareControl.tsx b/ui/src/components/workbench/ShowPageShareControl.tsxindex 3f2b95728..473b11758 100644--- a/ui/src/components/workbench/ShowPageShareControl.tsx+++ b/ui/src/components/workbench/ShowPageShareControl.tsx@@ -13,6 +13,7 @@ import { isIosDevice, isRealMobileSafari, isStandalonePwa } from '../../lib/platimport { copyHref, type ShowPageLinkInfo } from '../../lib/showPageLinks';import {canChangeShowPagePublicLink,+ showPageShareCapabilities,type ShowPageAccess,} from '../../lib/showPageAccess';import { ShowPageShareIdField } from './ShowPageShareIdField';@@ -30,7 +31,8 @@ type ShowPagePayload = ShowPageLinkInfo & {// Share affordance for the current session's Show Page. Resource managers may// open the audience controls without receiving access to the page content;-// public-link and link actions render only when the caller can use the page.+// page links render only when the caller can use the page; an access-only+// manager receives a metadata-only control for revoking an existing public link.export const ShowPageShareControl: React.FC<{sessionId: string;initialAccess?: ShowPageAccess | null;@@ -48,6 +50,7 @@ export const ShowPageShareControl: React.FC<{const { pages, mergePage, reload } = useShowPageInventory();const inventoryPage = pages.find((page) => page.session_id === sessionId);const [open, setOpen] = useState(false);+ const [workspaceConfirmationOpen, setWorkspaceConfirmationOpen] = useState(false);const [localPayload, setLocalPayload] = useState<ShowPagePayload | null>(null);const candidatePayload = useMemo<ShowPagePayload | null>(() => {const local = localPayload?.session_id === sessionId ? localPayload : null;@@ -71,7 +74,8 @@ export const ShowPageShareControl: React.FC<{const [loading, setLoading] = useState(false);const [accessLoading, setAccessLoading] = useState(false);const [access, setAccess] = useState<ShowPageAccess | null>(initialAccess);- const payload = access?.can_use === false ? null : candidatePayload;+ const shareCapabilities = showPageShareCapabilities(access);+ const payload = shareCapabilities.canReadPayload ? candidatePayload : null;const [accessError, setAccessError] = useState(false);const [busy, setBusy] = useState(false);const [copied, setCopied] = useState(false);@@ -167,6 +171,7 @@ export const ShowPageShareControl: React.FC<{const handleOpenChange = (next: boolean) => {setOpen(next);+ if (!next) setWorkspaceConfirmationOpen(false);onOpenChange?.(next);if (next) refresh();};@@ -189,6 +194,24 @@ export const ShowPageShareControl: React.FC<{.finally(() => setBusy(false));};+ const revokePublicLinkWithoutPayload = () => {+ if (!shareCapabilities.canRevokePublicLinkWithoutPayload) return;+ setBusy(true);+ api+ .setShowPageVisibility(sessionId, 'private')+ .then(() => {+ // Do not retain the mutation payload: this manager can revoke anonymous+ // access but cannot read the page, its link, or its share identifier.+ setAccess((current) => current ? {+ ...current,+ public_link_enabled: false,+ } : current);+ reqSeq.current += 1;+ })+ .catch(() => undefined)+ .finally(() => setBusy(false));+ };+const rotatePublicLink = () => {setBusy(true);api@@ -232,7 +255,13 @@ export const ShowPageShareControl: React.FC<{<Share2 className="size-3.5" /></Button></PopoverTrigger>- <PopoverContent align="end" className="w-80 space-y-3">+ <PopoverContent+ align="end"+ className="w-80 space-y-3"+ onInteractOutside={(event) => {+ if (workspaceConfirmationOpen) event.preventDefault();+ }}+ ><div className="text-sm font-medium">{t('chat.showPage.shareTitle')}</div>{loading && !access ? (@@ -306,6 +335,7 @@ export const ShowPageShareControl: React.FC<{access={access}active={open}sessionId={sessionId}+ onConfirmationOpenChange={setWorkspaceConfirmationOpen}/>{accessError ? (<p className="mt-2 text-[11px] leading-snug text-destructive">@@ -314,6 +344,34 @@ export const ShowPageShareControl: React.FC<{) : null}</div>+ {shareCapabilities.canRevokePublicLinkWithoutPayload ? (+ <div className="border-t border-border pt-3">+ <div className="flex items-center justify-between gap-3">+ <div className="min-w-0">+ <div className="text-sm font-medium">{t('chat.showPage.publicLink')}</div>+ <p className="mt-0.5 text-[11px] leading-snug text-muted">+ {t('chat.showPage.publicLinkOnDesc')}+ </p>+ </div>+ <Switch+ checked+ disabled={+ busy+ || accessLoading+ || !canChangeShowPagePublicLink(access, false)+ }+ onCheckedChange={(next) => {+ if (!next) revokePublicLinkWithoutPayload();+ }}+ label={t('chat.showPage.publicLink')}+ />+ </div>+ <p className="mt-1.5 text-[11px] leading-snug text-muted">+ {t('chat.showPage.publicLinkOwnerOnly')}+ </p>+ </div>+ ) : null}+{payload ? (<><div className="border-t border-border pt-3">diff --git a/ui/src/components/workbench/ShowPageWorkspaceAccessControl.test.tsx b/ui/src/components/workbench/ShowPageWorkspaceAccessControl.test.tsxindex 1e6ab0ce9..313d6e630 100644--- a/ui/src/components/workbench/ShowPageWorkspaceAccessControl.test.tsx+++ b/ui/src/components/workbench/ShowPageWorkspaceAccessControl.test.tsx@@ -8,6 +8,12 @@ vi.mock('react-i18next', () => ({useTranslation: () => ({ t: (key: string) => key }),}));+vi.mock('@/components/ui/confirm-dialog', () => ({+ ConfirmDialog: ({ open, title }: { open: boolean; title: string }) => (+ <div data-confirm-open={String(open)}>{title}</div>+ ),+}));+const access = (overrides: Partial<ShowPageAccess> = {}): ShowPageAccess => ({ok: true,mode: 'organization',@@ -59,4 +65,11 @@ describe('ShowPageWorkspaceAccessControl', () => {expect(html).toContain('<select disabled=""');expect(html).toContain('chat.showPage.workspaceReadOnly');});++ it('mounts the established Organization audience-narrowing confirmation', () => {+ const html = renderControl(access({ access_level: 'public' }));++ expect(html).toContain('data-confirm-open="false"');+ expect(html).toContain('organization.resources.narrowTitle');+ });});diff --git a/ui/src/components/workbench/ShowPageWorkspaceAccessControl.tsx b/ui/src/components/workbench/ShowPageWorkspaceAccessControl.tsxindex af0763b89..ad82ed08a 100644--- a/ui/src/components/workbench/ShowPageWorkspaceAccessControl.tsx+++ b/ui/src/components/workbench/ShowPageWorkspaceAccessControl.tsx@@ -14,6 +14,7 @@ import { useTranslation } from 'react-i18next';import { Button } from '@/components/ui/button';import { Checkbox } from '@/components/ui/checkbox';+import { ConfirmDialog } from '@/components/ui/confirm-dialog';import { Select } from '@/components/ui/select';import {isRevisionConflict,@@ -27,7 +28,10 @@ import type {OrganizationResource,ResourceAccessLevel,} from '@/features/organization/api/types';-import { organizationAuthorizationReturnPath } from '@/features/organization/policy';+import {+ organizationAuthorizationReturnPath,+ requiresResourceAccessNarrowingConfirmation,+} from '@/features/organization/policy';import {buildShowPageAccessPatch,showPageAudienceLabelKey,@@ -75,10 +79,12 @@ export function ShowPageWorkspaceAccessControl({access,active,sessionId,+ onConfirmationOpenChange,}: {access: ShowPageAccess | null;active: boolean;sessionId: string;+ onConfirmationOpenChange?: (open: boolean) => void;}) {const { t } = useTranslation();const [gate, setGate] = useState<ManagementGate>('idle');@@ -87,11 +93,16 @@ export function ShowPageWorkspaceAccessControl({const [level, setLevel] = useState<ResourceAccessLevel>(access?.access_level ?? 'private');const [groupIds, setGroupIds] = useState<string[]>(access?.group_ids ?? []);const [saving, setSaving] = useState(false);+ const [confirmNarrowing, setConfirmNarrowing] = useState(false);const generationRef = useRef(0);const organizationId = access?.organization_id ?? null;const instanceId = access?.instance_id ?? null;const canManage = access?.can_manage === true;+ const setNarrowingConfirmationOpen = useCallback((next: boolean) => {+ setConfirmNarrowing(next);+ onConfirmationOpenChange?.(next);+ }, [onConfirmationOpenChange]);const accessPath = useMemo(() => {if (!organizationId || !instanceId) return null;@@ -139,6 +150,7 @@ export function ShowPageWorkspaceAccessControl({setGroups([]);setLevel(access?.access_level ?? 'private');setGroupIds(access?.group_ids ?? []);+ setNarrowingConfirmationOpen(false);setGate('idle');if (active && access?.mode === 'organization' && access.can_manage) {void loadManagement();@@ -146,7 +158,7 @@ export function ShowPageWorkspaceAccessControl({return () => {generationRef.current += 1;};- }, [access, active, loadManagement]);+ }, [access, active, loadManagement, setNarrowingConfirmationOpen]);const visibleGroups = groups.filter((group) => !group.archived_at || groupIds.includes(group.id));const toggleGroup = (group: OrganizationGroup) => {@@ -170,7 +182,7 @@ export function ShowPageWorkspaceAccessControl({);const editable = access?.mode === 'organization' && canManage && gate === 'ready' && !saving;- const save = async () => {+ const commit = async () => {if (!accessPath || !patch || !dirty || !editable) return;setSaving(true);try {@@ -186,7 +198,22 @@ export function ShowPageWorkspaceAccessControl({setGate(isRevisionConflict(error) ? 'conflict' : gateForError(error));} finally {setSaving(false);+ setNarrowingConfirmationOpen(false);+ }+ };++ const save = () => {+ if (!patch || !dirty || !editable) return;+ if (requiresResourceAccessNarrowingConfirmation(+ currentLevel,+ currentGroupIds,+ patch.access_level,+ patch.group_ids,+ )) {+ setNarrowingConfirmationOpen(true);+ return;}+ void commit();};const startAuthorization = async () => {@@ -215,7 +242,8 @@ export function ShowPageWorkspaceAccessControl({const syncPresentation = resource ? showPageSyncPresentation(resource.sync.status) : null;return (- <section className="space-y-2.5" aria-label={t('chat.showPage.workspaceAccess')}>+ <>+ <section className="space-y-2.5" aria-label={t('chat.showPage.workspaceAccess')}><div className="flex items-center justify-between gap-3"><div className="min-w-0"><div className="text-sm font-medium">{t('chat.showPage.workspaceAccess')}</div>@@ -366,13 +394,22 @@ export function ShowPageWorkspaceAccessControl({variant="outline"className="h-7"disabled={!dirty || !patch || saving}- onClick={() => void save()}+ onClick={save}>{saving ? <Loader2 className="size-3.5 animate-spin" /> : null}{t('chat.showPage.applyWorkspaceAccess')}</Button></div>) : null}- </section>+ </section>+ <ConfirmDialog+ open={confirmNarrowing}+ onOpenChange={setNarrowingConfirmationOpen}+ title={t('organization.resources.narrowTitle')}+ description={t('organization.resources.narrowBody')}+ confirmLabel={t('organization.actions.saveChanges')}+ onConfirm={commit}+ />+ </>);}diff --git a/ui/src/lib/showPageAccess.test.ts b/ui/src/lib/showPageAccess.test.tsindex d0ac5db31..dfcd34e6f 100644--- a/ui/src/lib/showPageAccess.test.ts+++ b/ui/src/lib/showPageAccess.test.ts@@ -4,6 +4,7 @@ import { isRevisionConflict, OrganizationApiError } from '@/features/organizatioimport {buildShowPageAccessPatch,canChangeShowPagePublicLink,+ showPageShareCapabilities,showPageHeaderAccess,showPageAudienceLabelKey,showPageAudienceLevels,@@ -67,6 +68,21 @@ describe('Show Page access policy helpers', () => {expect(canChangeShowPagePublicLink(access(), true)).toBe(true);});+ it('lets an access-only manager revoke a Public link without reading its payload', () => {+ const manager = access({+ can_use: false,+ can_publish_public: false,+ public_link_enabled: true,+ });++ expect(showPageShareCapabilities(manager)).toEqual({+ canReadPayload: false,+ canRevokePublicLinkWithoutPayload: true,+ });+ expect(canChangeShowPagePublicLink(manager, false)).toBe(true);+ expect(canChangeShowPagePublicLink(manager, true)).toBe(false);+ });+it('separates page use from page-specific access management in the chat header', () => {expect(showPageHeaderAccess(false, access({ can_use: true, can_manage: false }))).toEqual({canOpen: true,diff --git a/ui/src/lib/showPageAccess.ts b/ui/src/lib/showPageAccess.tsindex e9393598e..c43a9d494 100644--- a/ui/src/lib/showPageAccess.ts+++ b/ui/src/lib/showPageAccess.ts@@ -65,6 +65,21 @@ export function canChangeShowPagePublicLink(return nextEnabled ? access.can_publish_public : access.can_manage;}+export function showPageShareCapabilities(access: ShowPageAccess | null): {+ canReadPayload: boolean;+ canRevokePublicLinkWithoutPayload: boolean;+} {+ return {+ canReadPayload: access?.can_use !== false,+ canRevokePublicLinkWithoutPayload: Boolean(+ access+ && !access.can_use+ && access.can_manage+ && access.public_link_enabled,+ ),+ };+}+export function showPageSyncPresentation(status: SyncStatus): {key: string;tone: 'muted' | 'pending' | 'error';diff --git a/vibe/api.py b/vibe/api.pyindex 8876bed42..a64e113b6 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -1195,14 +1195,30 @@ def set_show_page_visibility(session_id: str, visibility: str) -> dict:route layer maps to a 4xx response."""from core.show_pages import ShowPageStore, show_page_payload+ from storage import resource_access_serviceconfig = V2Config.load()+ context = resource_access_service.resolve_resource_access_context()store = ShowPageStore()try:updated = store.update_visibility(session_id, visibility)- payload = show_page_payload(updated, config=config)+ with store.engine.connect() as connection:+ can_use = resource_access_service.can_use_resource(+ context,+ "show_page",+ session_id,+ connection=connection,+ )+ payload = show_page_payload(updated, config=config) if can_use else Nonefinally:store.close()+ if payload is None:+ # Audience managers may revoke an anonymous link without page-use+ # access. Do not return page paths, URLs, share IDs, or session metadata.+ return {+ "ok": True,+ "public_link_enabled": updated.visibility == "public",+ }return {"ok": True, **_apply_session_meta([payload])[0]}diff --git a/vibe/authorization.py b/vibe/authorization.pyindex fdbbae73c..14534abdb 100644--- a/vibe/authorization.py+++ b/vibe/authorization.py@@ -286,6 +286,7 @@ _VIEWER_HTTP_RULES = tuple(_VIEWER_HTTP_MUTATION_RULES = tuple((method, re.compile(pattern))for method, pattern in (+ ("POST", r"^/api/show-pages/[^/]+/ensure$"),("POST", r"^/api/show-pages/[^/]+/visibility$"),("POST", r"^/api/show-pages/[^/]+/rotate-share$"),("POST", r"^/api/show-pages/[^/]+/share-id$"),diff --git a/vibe/remote_access.py b/vibe/remote_access.pyindex af44ff9bd..03f89227c 100644--- a/vibe/remote_access.py+++ b/vibe/remote_access.py@@ -1323,7 +1323,7 @@ def _sync_one_organization(acknowledged = 0skipped = 0ack_errors = 0- narrowed_resource_kinds: set[str] = set()+ affected_resource_kinds: set[str] = set()engine = get_cached_sqlite_engine()for raw_intent in intents:try:@@ -1363,8 +1363,6 @@ def _sync_one_organization(outcome["policy"],))- if policy_narrowed:- narrowed_resource_kinds.add(resource_kind)if resource_kind == "vault_secret" and outcome["status"] == "applied":from storage import vault_service@@ -1379,6 +1377,7 @@ def _sync_one_organization(if release_key is not None:release_scopes = _load_pending_vault_release_scopes(connection, release_key)if outcome["status"] == "applied":+ affected_resource_kinds.add(resource_kind)applied += 1if release_scopes:try:@@ -1441,14 +1440,14 @@ def _sync_one_organization(except Exception:logger.warning("failed to clear published empty resource organization", exc_info=True)ack_errors += 1- if narrowed_resource_kinds:+ if affected_resource_kinds:from vibe.sse_broker import brokerbroker.publish("authorization.changed",{"project_ids": [],- "resource_kinds": sorted(narrowed_resource_kinds),+ "resource_kinds": sorted(affected_resource_kinds),},)return {