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): preserve denied-page UX after lease revocation
Call White81d72b56e598
diff --git a/tests/scenarios/auth_setup/catalog.yaml b/tests/scenarios/auth_setup/catalog.yamlindex 389a4475f..9a4a4df06 100644--- a/tests/scenarios/auth_setup/catalog.yaml+++ b/tests/scenarios/auth_setup/catalog.yaml@@ -191,7 +191,7 @@ scenarios:backend: webtest: tests/scenarios/auth_setup/test_auth_setup_scenarios.py::test_organization_remote_session_recovers_and_revokes_without_oauth- id: AUTH-SETUP-404- name: Verified limited Show Page identity completes local guest admission+ name: Verified limited Show Page identity admits and denies a revoked guest leasestatus: coveredkind: happy_pathlayer: scenariodiff --git a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py b/tests/scenarios/auth_setup/test_auth_setup_scenarios.pyindex c85ac96dd..aa1e8b703 100644--- a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py+++ b/tests/scenarios/auth_setup/test_auth_setup_scenarios.py@@ -41,7 +41,7 @@ from modules.agents.codex.agent import CodexAgentfrom tests.scenario_harness.auth_setup import AuthSetupScenarioHarness, FakeProcessfrom tests.scenario_harness.core import ScenarioExpect, ScenarioRunner, ScenarioStepfrom tests.scenario_harness.show_page_email_access import ShowPageEmailAccessScenarioHarness-from tests.ui_server_test_helpers import _save_config+from tests.ui_server_test_helpers import _save_config, remote_session_cookiefrom storage import remote_access_authorization_servicefrom tests.scenario_harness.model_hub_native_oauth import (HubOAuthScenarioHarness,@@ -213,6 +213,58 @@ def test_limited_show_identity_closed_loop_installs_guest_lease(monkeypatch, tmpassert replay.status_code == 400assert replay.get_json()["error"] == "replayed_assertion"+ store = ShowPageStore()+ try:+ access = store.get_access(page.session_id)+ assert access is not None+ revoked = store.apply_access(+ page.session_id,+ expected_revision=access.revision,+ target_access_mode="limited",+ target_share_id=page.share_id,+ target_emails=["[email protected]"],+ )+ assert revoked.status == "applied"+ finally:+ store.close()++ client.set_cookie(+ remote_access.SESSION_COOKIE_NAME,+ remote_session_cookie(+ config,+ "[email protected]",+ "viewer-1",+ session_claims={+ "vibe_instance_id": cloud.instance_id,+ "vibe_instance_role": "viewer",+ "vibe_instance_access_source": "show_page_email",+ "vibe_show_page_id": page.session_id,+ },+ ),+ domain="alex.avibe.bot",+ )+ revoked_navigation = client.get(+ f"/p/{page.share_id}/",+ base_url="https://alex.avibe.bot",+ environ_base=remote_peer,+ headers={+ "Accept": "text/html",+ "Sec-Fetch-Mode": "navigate",+ "Sec-Fetch-Dest": "document",+ },+ follow_redirects=False,+ )+ assert revoked_navigation.status_code == 403+ assert "Location" not in revoked_navigation.headers+ assert "You do not have access to this page" in revoked_navigation.text++ revoked_subresource = client.get(+ f"/p/{page.share_id}/app.js",+ base_url="https://alex.avibe.bot",+ environ_base=remote_peer,+ )+ assert revoked_subresource.status_code == 404+class _FakeNextTurnRuntime:def __init__(self):diff --git a/tests/test_ui_show_pages.py b/tests/test_ui_show_pages.pyindex 7bd92f830..bfa5ad74b 100644--- a/tests/test_ui_show_pages.py+++ b/tests/test_ui_show_pages.py@@ -1352,6 +1352,39 @@ def test_limited_show_guest_is_rechecked_after_access_changes()assert stale_limited_navigation.status_code == 404+ client.set_cookie(+ remote_access.SESSION_COOKIE_NAME,+ remote_session_cookie(+ config,+ "[email protected]",+ "viewer-1",+ role="viewer",+ ),+ domain="alex.avibe.bot",+ )+ authenticated_revoked_navigation = client.get(+ f"/p/{share_id}/",+ base_url="https://alex.avibe.bot",+ environ_base=_remote_peer(),+ headers={"Accept": "text/html"},+ follow_redirects=False,+ )+ assert authenticated_revoked_navigation.status_code == 403+ assert "You do not have access to this page" in authenticated_revoked_navigation.text+ assert "Please contact the page owner" in authenticated_revoked_navigation.text+ assert "Location" not in authenticated_revoked_navigation.headers++ for entry_path in (f"/p/{share_id}/", f"/p/{share_id}/index.html"):+ non_html_entry = client.get(+ entry_path,+ base_url="https://alex.avibe.bot",+ environ_base=_remote_peer(),+ headers={"Accept": "application/json"},+ follow_redirects=False,+ )+ assert non_html_entry.status_code == 404+ assert non_html_entry.get_json() == {"error": "not_found"}+fresh_client = app.test_client()fresh_login = fresh_client.get(f"/p/{share_id}/",diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex aca180a5d..e6b2a8e4d 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -12980,6 +12980,28 @@ def _show_public_authenticated_context(config: V2Config | None):return context_from_session_payload(session) if session is not None else None+def _show_limited_viewer_is_allowed(+ context: Any,+ access: Any,+ page_id: str,+ *,+ allow_page_scoped: bool = True,+) -> bool:+ from core.show_pages import normalize_show_access_email++ allowlisted = False+ if context.email:+ try:+ allowlisted = (+ access is not None+ and normalize_show_access_email(context.email)+ in access.normalized_emails+ )+ except (TypeError, ValueError):+ allowlisted = False+ return allowlisted or (allow_page_scoped and context.can_use_show_page(page_id))++async def _show_public_request_author() -> dict[str, str] | None:context = await asyncio.to_thread(_show_public_editor_context)if context is None:@@ -14951,14 +14973,50 @@ async def serve_public_show_page(share_id, asset_path):# Already-rendered pages are not proactively closed, but every# subsequent request must match the current local access record.access = store.get_access(page.session_id)- if (- access is None- or page.visibility != "limited"- or access.access_mode != "limited"- or access.share_id != share_id- or lease.normalized_email not in access.normalized_emails- ):- return _show_limited_not_found_response()+ lease_is_current = (+ access is not None+ and page.visibility == "limited"+ and access.access_mode == "limited"+ and access.share_id == share_id+ and lease.normalized_email in access.normalized_emails+ )+ if not lease_is_current:+ current_limited_binding = (+ access is not None+ and page.visibility == "limited"+ and access.access_mode == "limited"+ and access.share_id == share_id+ )+ if current_limited_binding:+ authenticated_context = await asyncio.to_thread(+ _show_public_authenticated_context,+ config,+ )+ if (+ authenticated_context is not None+ and request.method == "GET"+ and is_spa_navigation+ and _show_page_accepts_html()+ ):+ if not _show_limited_viewer_is_allowed(+ authenticated_context,+ access,+ page.session_id,+ allow_page_scoped=False,+ ):+ return _show_page_access_denied_response(+ include_back_link=(+ authenticated_context.instance_access_source+ != "show_page_email"+ )+ )+ # The current identity may be allowed again, but the+ # old lease must not be treated as valid guest access.+ limited_guest = False+ else:+ return _show_limited_not_found_response()+ else:+ return _show_limited_not_found_response()if page.visibility == "limited":if not limited_guest:if request.method != "GET" or not is_spa_navigation:@@ -14969,18 +15027,11 @@ async def serve_public_show_page(share_id, asset_path):)if authenticated_context is not None:access = store.get_access(page.session_id)- allowlisted = False- if authenticated_context.email:- try:- allowlisted = (- access is not None- and normalize_show_access_email(authenticated_context.email)- in access.normalized_emails- )- except (TypeError, ValueError):- allowlisted = False- page_scoped = authenticated_context.can_use_show_page(page.session_id)- if not allowlisted and not page_scoped:+ if not _show_limited_viewer_is_allowed(+ authenticated_context,+ access,+ page.session_id,+ ):return _show_page_access_denied_response(include_back_link=(authenticated_context.instance_access_source != "show_page_email"