Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Recognize OIDC sessions that carry no refresh token

rcourtmanb3ae6f72b695
diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.ts
index 3c850dd16d..9eb6e81f40 100644
--- a/frontend-modern/src/__tests__/App.architecture.test.ts
+++ b/frontend-modern/src/__tests__/App.architecture.test.ts
@@ -416,9 +416,12 @@ describe('App architecture', () => {
expect(appRuntimeStateSource).toContain(
'const isPreAuthLoginBootstrapPath = (pathname: string): boolean =>',
);
+ expect(appRuntimeStateSource).toContain('const hasSSOCallbackSuccessHint = (): boolean => {');
expect(appRuntimeStateSource).toContain(
- 'if (isPreAuthLoginBootstrapPath(window.location.pathname) && !hasLocalAuthBootstrapHint()) {',
+ 'isPreAuthLoginBootstrapPath(window.location.pathname) &&',
);
+ expect(appRuntimeStateSource).toContain('!hasLocalAuthBootstrapHint() &&');
+ expect(appRuntimeStateSource).toContain('!hasSSOCallbackSuccessHint()');
expect(appRuntimeStateSource).toContain('aiChatStore.setEnabled(');
expect(appRuntimeStateSource).toContain('aiIntelligenceStore.loadPatrolFindings()');
expect(appRuntimeStateSource).toContain('aiIntelligenceStore.loadPendingApprovals()');
diff --git a/frontend-modern/src/useAppRuntimeState.ts b/frontend-modern/src/useAppRuntimeState.ts
index b26f7fa372..1ac7cdac9f 100644
--- a/frontend-modern/src/useAppRuntimeState.ts
+++ b/frontend-modern/src/useAppRuntimeState.ts
@@ -104,6 +104,22 @@ export const useAppRuntimeState = () => {
}
};
+ // A completed SSO redirect (?oidc=success / ?saml=success) means a session
+ // cookie may exist even though no local-auth artifacts do, so the pre-auth
+ // bootstrap short-circuit below must not pin the user to the login page
+ // before the /api/state probe runs (issue #1574).
+ const hasSSOCallbackSuccessHint = (): boolean => {
+ if (typeof window === 'undefined') {
+ return false;
+ }
+ try {
+ const params = new URLSearchParams(window.location.search);
+ return params.get('oidc') === 'success' || params.get('saml') === 'success';
+ } catch {
+ return false;
+ }
+ };
+
const fallbackState: State = {
connectedInfrastructure: [],
metrics: [],
@@ -673,7 +689,11 @@ export const useAppRuntimeState = () => {
return;
}
- if (isPreAuthLoginBootstrapPath(window.location.pathname) && !hasLocalAuthBootstrapHint()) {
+ if (
+ isPreAuthLoginBootstrapPath(window.location.pathname) &&
+ !hasLocalAuthBootstrapHint() &&
+ !hasSSOCallbackSuccessHint()
+ ) {
logger.debug('[App] Public login bootstrap has no local auth hint yet', {
pathname: window.location.pathname,
});
diff --git a/internal/api/oidc_handlers.go b/internal/api/oidc_handlers.go
index 697375a47b..7775bb666d 100644
--- a/internal/api/oidc_handlers.go
+++ b/internal/api/oidc_handlers.go
@@ -668,15 +668,19 @@ func (r *Router) handleSSOOIDCCallback(w http.ResponseWriter, req *http.Request)
}
}
- // Store OIDC tokens for session refresh
- var oidcTokens *OIDCTokenInfo
+ // Stamp issuer/client on the session even when the provider issued no
+ // refresh token (e.g. offline_access not requested): the SSO-session
+ // surfaces (/api/security/status ssoSessionUsername, X-Auth-Method) key on
+ // OIDCIssuer, and without it a successful SSO login reports an empty SSO
+ // session and strands the user on the login page (issue #1574). Token
+ // refresh itself stays gated on RefreshToken being present.
+ oidcTokens := &OIDCTokenInfo{
+ Issuer: provider.OIDC.IssuerURL,
+ ClientID: provider.OIDC.ClientID,
+ }
if token.RefreshToken != "" {
- oidcTokens = &OIDCTokenInfo{
- RefreshToken: token.RefreshToken,
- AccessTokenExp: token.Expiry,
- Issuer: provider.OIDC.IssuerURL,
- ClientID: provider.OIDC.ClientID,
- }
+ oidcTokens.RefreshToken = token.RefreshToken
+ oidcTokens.AccessTokenExp = token.Expiry
}
if err := r.establishOIDCSession(w, req, principal, username, oidcTokens); err != nil {