From dd0bb7ab2e07e5e8d53dbfdfd5ccd259ae0cb0c5 Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2026 12:29:33 +0000 Subject: [PATCH] Confirm local sign-out before proxy navigation End the browser session and clear saved state before the configured provider redirect; keep failed or uncertain withdrawal visible and retry deliberate. Preserve normal credential and CSRF transport, independent tokens and administrator recovery. Contract-Neutral: Repair the existing sign-out client sequence and feedback; no API, grant, provider protocol, route, storage/recovery, AI or polling contract delta. Change-source: pulse-maintainer --- docs/PROXY_AUTH.md | 11 +- .../v6/internal/subsystems/cloud-paid.md | 23 +++ .../subsystems/performance-and-scalability.md | 23 +++ frontend-modern/public/docs/PROXY_AUTH.md | 11 +- frontend-modern/src/App.tsx | 1 + frontend-modern/src/AppLayout.tsx | 7 +- .../src/__tests__/AppLayout.test.tsx | 14 ++ .../src/__tests__/useAppRuntimeState.test.ts | 147 ++++++++++++++++++ frontend-modern/src/useAppRuntimeState.ts | 100 ++++++++---- .../utils/__tests__/apiClient.auth.test.ts | 23 +++ frontend-modern/src/utils/apiClient.ts | 4 +- .../test_authentication_diagnostic_docs.py | 4 +- 12 files changed, 326 insertions(+), 42 deletions(-) diff --git a/docs/PROXY_AUTH.md b/docs/PROXY_AUTH.md index 87a9614a5e..765139d9fc 100644 --- a/docs/PROXY_AUTH.md +++ b/docs/PROXY_AUTH.md @@ -128,14 +128,17 @@ Proxy authentication is checked on each request. If the authenticating proxy still supplies a valid identity, Pulse can admit that user again without a local password prompt. -- **With `PROXY_AUTH_LOGOUT_URL`:** Pulse's **Sign out** action sends the browser - directly to that URL, instead of calling Pulse's local `/api/logout` endpoint. +- **With `PROXY_AUTH_LOGOUT_URL`:** Pulse's **Sign out** action first calls + Pulse's local `/api/logout` endpoint. Only after Pulse confirms success and + clears this browser's saved authentication and cached metadata does it send + the browser to that URL. A refused request, lost response or browser-cleanup + error is shown instead of a redirect; it does not confirm withdrawn access. The destination must perform the required logout in your existing proxy/IdP integration; simply opening a login page or returning to Pulse does not end either upstream session. Some integrations have separate proxy and IdP sessions, so an active IdP session can sign the user straight back in. -- **Without that URL:** Pulse uses its local logout endpoint and leaves the - proxy/IdP sessions alone. Ending one Pulse browser session does not revoke +- **Without that URL:** Pulse uses the same confirmed local logout and browser + cleanup, returns to its login page and leaves the proxy/IdP sessions alone. Ending one Pulse browser session does not revoke other browser sessions, API tokens or the shared proxy secret. Use the logout route documented for your installed authenticating proxy and its diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md index 903443f74e..aed6427e9f 100644 --- a/docs/release-control/v6/internal/subsystems/cloud-paid.md +++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md @@ -3935,3 +3935,26 @@ Chat)"), not as a Pro capability, so no paid entitlement changes. Paid Patrol capabilities stay as they were: Patrol modes, investigations, governed fixes, and history live on the Patrol and Actions surfaces, and alert Investigate now starts a targeted Patrol run instead of opening a chat. + +### Sign-out confirms local withdrawal before provider navigation + +The existing app runtime sends a single bounded, cookie/CSRF-bearing POST to +`/api/logout` before clearing saved authentication and cached metadata, stopping +its runtime and following any configured proxy/SSO destination. It requires the +endpoint's successful JSON acknowledgement; rejection, a redirect, malformed +reply, lost response or timeout stays visibly uncertain and allows deliberate +retry. The API client must not turn a logout 401 into a success-looking login +redirect. Token-only browsers keep the normal authenticated transport; this +ends only the cookie session, not independent API tokens or other sessions. +Provider navigation still owns upstream sign-out. A browser cleanup failure +remains explicit, does not skip remaining cleanup and does not redirect. + +The actual Layout control is busy/disabled during withdrawal. Disposing its +runtime aborts pending transport and prevents late cleanup/navigation. No new +route, polling, grant, provider protocol, server invalidation rule or recovery +operation is introduced. Registered runtime, API-client auth and AppLayout +tests cover order, uncertainty, transport, duplicate attempts, retry, timeout, +disposal and storage failure. Desktop/narrow browser proof exercises the actual +consumer with synthetic independent sessions and inspected pixels; it is not +live IdP or original administrator recovery. The proxy guide and shipped mirror +must describe the same sequence without claiming upstream revocation. diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md index d3b537a07b..5a737eee34 100644 --- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md +++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md @@ -4654,3 +4654,26 @@ usage and `Dialog.test.tsx` owns modal isolation/focus. Browser proof exercises the consuming TrueNAS table with ordinary keyboard/phone taps, hover parity, updates and dismissal, and natively inspected desktop/narrow pixels. This repairs composition access, not the reporter's missing native ARC or I/O/History source. + +### Sign-out confirms local withdrawal before provider navigation + +The existing app runtime sends a single bounded, cookie/CSRF-bearing POST to +`/api/logout` before clearing saved authentication and cached metadata, stopping +its runtime and following any configured proxy/SSO destination. It requires the +endpoint's successful JSON acknowledgement; rejection, a redirect, malformed +reply, lost response or timeout stays visibly uncertain and allows deliberate +retry. The API client must not turn a logout 401 into a success-looking login +redirect. Token-only browsers keep the normal authenticated transport; this +ends only the cookie session, not independent API tokens or other sessions. +Provider navigation still owns upstream sign-out. A browser cleanup failure +remains explicit, does not skip remaining cleanup and does not redirect. + +The actual Layout control is busy/disabled during withdrawal. Disposing its +runtime aborts pending transport and prevents late cleanup/navigation. No new +route, polling, grant, provider protocol, server invalidation rule or recovery +operation is introduced. Registered runtime, API-client auth and AppLayout +tests cover order, uncertainty, transport, duplicate attempts, retry, timeout, +disposal and storage failure. Desktop/narrow browser proof exercises the actual +consumer with synthetic independent sessions and inspected pixels; it is not +live IdP or original administrator recovery. The proxy guide and shipped mirror +must describe the same sequence without claiming upstream revocation. diff --git a/frontend-modern/public/docs/PROXY_AUTH.md b/frontend-modern/public/docs/PROXY_AUTH.md index 87a9614a5e..765139d9fc 100644 --- a/frontend-modern/public/docs/PROXY_AUTH.md +++ b/frontend-modern/public/docs/PROXY_AUTH.md @@ -128,14 +128,17 @@ Proxy authentication is checked on each request. If the authenticating proxy still supplies a valid identity, Pulse can admit that user again without a local password prompt. -- **With `PROXY_AUTH_LOGOUT_URL`:** Pulse's **Sign out** action sends the browser - directly to that URL, instead of calling Pulse's local `/api/logout` endpoint. +- **With `PROXY_AUTH_LOGOUT_URL`:** Pulse's **Sign out** action first calls + Pulse's local `/api/logout` endpoint. Only after Pulse confirms success and + clears this browser's saved authentication and cached metadata does it send + the browser to that URL. A refused request, lost response or browser-cleanup + error is shown instead of a redirect; it does not confirm withdrawn access. The destination must perform the required logout in your existing proxy/IdP integration; simply opening a login page or returning to Pulse does not end either upstream session. Some integrations have separate proxy and IdP sessions, so an active IdP session can sign the user straight back in. -- **Without that URL:** Pulse uses its local logout endpoint and leaves the - proxy/IdP sessions alone. Ending one Pulse browser session does not revoke +- **Without that URL:** Pulse uses the same confirmed local logout and browser + cleanup, returns to its login page and leaves the proxy/IdP sessions alone. Ending one Pulse browser session does not revoke other browser sessions, API tokens or the shared proxy secret. Use the logout route documented for your installed authenticating proxy and its diff --git a/frontend-modern/src/App.tsx b/frontend-modern/src/App.tsx index 0cf3eb8ccb..51806436dc 100644 --- a/frontend-modern/src/App.tsx +++ b/frontend-modern/src/App.tsx @@ -537,6 +537,7 @@ function App() { needsAuth={runtime.needsAuth} proxyAuthInfo={runtime.proxyAuthInfo} handleLogout={runtime.handleLogout} + isLoggingOut={runtime.isLoggingOut} state={runtime.state} platformVisibility={platformNavigationVisibility} tokenScopes={() => runtime.securityStatus()?.tokenScopes} diff --git a/frontend-modern/src/AppLayout.tsx b/frontend-modern/src/AppLayout.tsx index 4c3e4aec72..b9567a2604 100644 --- a/frontend-modern/src/AppLayout.tsx +++ b/frontend-modern/src/AppLayout.tsx @@ -143,6 +143,7 @@ export interface AppLayoutProps { needsAuth: () => boolean; proxyAuthInfo: () => { username?: string; logoutURL?: string } | null; handleLogout: () => void; + isLoggingOut?: () => boolean; state: () => State; platformVisibility?: () => PlatformNavigationVisibility; tokenScopes: () => string[] | undefined; @@ -804,9 +805,11 @@ export function AppLayout(props: AppLayoutProps) {