Repository navigation
Description
Detail Bug Report
Introduced in #31423 by @mohityadav766 on Aug 13, 2026
Summary
- Context: When an operator hot-swaps
AUTHENTICATION_PROVIDER(e.g. moving the deployment from Google SSO to Azure SSO, a documented off-boarding mechanism), REST requests carrying session-bound tokens (the JWTs the server mints with asessionIdclaim) are guarded byJwtFilter.validateSessionProviderIsCurrent, which immediately rejects any session issued by the now-deconfigured provider. The WebSocket entry points — the engine.io handshake filter and the periodic sweep that validates already-connected sockets — re-validate sessions but were never given the same check. - Bug:
SocketAddressFilter.validateSessionStillActive(handshake) andWebSocketManager.isSessionActiveForUser(60s sweep) never check thatUserSession.getProvider()is still among the configured providers, so sessions minted under a deconfigured provider remain fully usable on the socket path until natural expiry. - Actual vs. expected: REST requests fail immediately (session-bound tokens with "Session was issued by a provider that is no longer configured."; claim-less IdP tokens instead fail token validation under the new provider config) yet a WebSocket handshake is still accepted (cookie-only in the default insecure mode; claim-less-token + cookie in secure mode) and an already-connected socket survives every sweep iteration — while
JwtFilterdocuments that provider-swapped sessions "must stop working immediately instead of living on until natural expiry". - Impact: A user off-boarded by moving IdPs keeps a live push channel for up to the full 7-day default session expiry, silently receiving every activity-stream broadcast (org-wide feed events), mentions, task notifications, and other WebSocket-pushed events, although their REST access has been cut and the stated intent is that their access ends immediately.
Code with Bug
openmetadata-service/src/main/java/org/openmetadata/service/socket/SocketAddressFilter.java — handshake session validation:
Optional<UserSession> session = sessionService.getFreshSessionById(sessionId);
if (session.isEmpty()
|| session.get().getStatus() != SessionStatus.ACTIVE
|| session.get().isExpired(System.currentTimeMillis())) {
LOG.info(
"Rejecting WebSocket handshake: session {} is not active",
SessionService.truncateId(sessionId));
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Session is no longer active");
return SessionValidationResult.rejected();
}
// <-- BUG 🔴 no check that session.get().getProvider() matches the currently configured provideropenmetadata-service/src/main/java/org/openmetadata/service/socket/WebSocketManager.java — periodic revalidation sweep:
private boolean isSessionActiveForUser(
SessionService sessionService, String sessionId, UUID expectedUserId) {
return sessionService
.getFreshSessionById(sessionId)
.filter(
session ->
session.getStatus() == SessionStatus.ACTIVE
&& !session.isExpired(System.currentTimeMillis())
&& expectedUserId.toString().equals(session.getUserId()))
.isPresent(); // <-- BUG 🔴 no provider-currency check; stale-provider sessions keep sockets alive
}Explanation
The REST/auth filter enforces a “provider-currency” policy: if a session was issued by an authentication provider that is no longer configured (after AUTHENTICATION_PROVIDER is swapped), the session must be rejected immediately.
WebSocket authentication/validation (both initial handshake and the 60s “disconnect inactive sessions” sweep) only checks session status/expiry and user binding, so a session issued under a deconfigured provider continues to authenticate and remains connected until it naturally expires.
Codebase Inconsistency
The REST path explicitly enforces the missing predicate:
/**
* Sessions record the provider that authenticated them. Swapping {@code AUTHENTICATION_PROVIDER}
* decommissions that provider, so sessions minted under it must stop working immediately instead of
* living on until natural expiry — otherwise off-boarding a user by moving IdPs leaves their old
* token valid for up to a week.
*/
private void validateSessionProviderIsCurrent(UserSession session) {
...
if (!SessionProviders.isSameProvider(sessionProvider, providerType.value())) {
throw AuthenticationException.getInvalidTokenException(
"Session was issued by a provider that is no longer configured.");
}
}Exploit Scenario
- A user signs in normally and gets an
OM_SESSIONcookie whose backing session isACTIVEwithprovider = "google"(or another SSO provider), with a 7-day expiry. - The user keeps an engine.io/WebSocket client connected (e.g.
GET /api/v1/pushwith theOM_SESSIONcookie). In the default insecure-socket mode, the cookie alone authenticates the handshake. - The organization off-boards by swapping
AUTHENTICATION_PROVIDERto a different IdP; REST requests now fail immediately. - The WebSocket handshake and the periodic sweep accept/retain the old session because they do not check the session’s provider against current configuration.
- Until session expiry (up to 7 days by default), the client continues receiving activity-stream broadcasts and other WebSocket-pushed events.
Recommended Fix
Add the same provider-currency predicate used by REST (SessionProviders.isSameProvider(...) / existing SessionService.isFromAnotherProvider logic) to:
SocketAddressFilter.validateSessionStillActiveto reject handshakes for sessions issued by deconfigured providers.WebSocketManager.isSessionActiveForUser(or aSessionServicehelper it calls) so the sweep disconnects stale-provider sockets on the next tick.
History
This bug was introduced in commit 9397048 ("Fixes open-metadata/openmetadata-collate#5526: revoke sessions on user delete and provider swap, stop logging tokens at DEBUG (#31423)", 2026-08-13).
Tracing history:
SocketAddressFilter.validateSessionStillActiveandWebSocketManager.isSessionActiveForUserwere both originally shipped in 000fec7 ("Feature Session Management in Multiple Server Pods #21971: Session Management in Multiple Server Pods (Feature #21971: Session Management in Multiple Server Pods #26314)", 2026-06-03), which added socket-side session validation checking status, expiry and user-id binding. At that point there was no provider-currency semantics anywhere, so the absence of a provider check there was not yet a bug.- The provider-swap enforcement (SSO-27) — the requirement that sessions minted under a decommissioned
AUTHENTICATION_PROVIDER"must stop working immediately instead of living on until natural expiry" — was introduced by 9397048.git show --statconfirms it touchedJwtFilter.java(+54),SessionService.java(+61),SecurityUtil.java,UserRepository.java, the Basic/LDAP servlet handlers and their tests, but no socket files, leavingvalidateSessionStillActiveand the 60s sweep without the check. - Later commits to the socket files (bff7e08 relay feature, ca9b8c0 hardening batch) did not add any provider-currency logic, so 9397048 remains the most recent commit that clearly contributed to the bug's existence: it created the REST-only asymmetry the report describes.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone ✅
Activity
Vamsi-klu commentedon Nov 20, 2026
Triage on main@2cc8c552558: confirmed, and wider than the report. Under the default public client the UI opens the socket with the provider token and no OM_SESSION cookie, so the socket has no session and the sweep never re-checks it (WebSocketManager:132-134, :273); it outlives the swap indefinitely. Session-bound sockets are exposed through the cookie handshake (SocketAddressFilter.validateSessionStillActive) and the sweep (WebSocketManager.isSessionActiveForUser). A handshake that presents an OM token with a sessionId claim is already rejected, through JwtFilter.checkValidationsForToken -> validateSessionProviderIsCurrent.
Planned fix:
Separate follow-ups: sessionless sockets outliving token expiry and user deletion; same-type provider switches (tenant or issuer change); sockets rejecting REFRESHING sessions.
Close a push-feed socket that registers after a provider switch (open…
Judge push-feed sockets against the provider the socket filter applied (
Fixes open-metadata#36608: Close push-feed sockets when the authentic…
Fixes #36608: Close push-feed sockets when the authentication provide…