Skip to content

Fixes #38245: Close push feed sockets without a session when their token expires or their user is deleted (backport 2.1 #38876) - #39277

Merged
manerow merged 1 commit into
2.1from
fix/38245-sessionless-socket-lifetime-2.1
Nov 30, 2026
Merged

manerow merged 1 commit into
2.1from
fix/38245-sessionless-socket-lifetime-2.1

Conversation

@manerow

@manerow manerow commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Issue

Cherry-pick of PR #38876 (Fixes #38245) onto 2.1.

What this fixes

The UI keeps a live websocket open to the server for push updates. When a socket is opened with a token that has no login session (a public client SSO provider token, a bot token or a personal access token), the server checked the token once at connect and never again. The socket stayed open after the token expired and after its user was deleted.

With this change:

  • The server remembers the token's expiry at connect time and closes the socket at the first sweep after it (the sweep runs every 60 s by default).
  • Just before closing, the server sends tokenExpiredChannel. The UI reconnects once with its renewed token only after that notice, so public client SSO tabs keep working. Any other server close is still final.
  • Deleting a user, soft or hard, closes all of their sockets right away, on this server and on the others (through the existing Redis revoke message). The sweep also closes the sockets of a user who no longer exists, for servers without Redis.

Why 2.1

2.1 has the same code as main before the fix: 8 of the 10 production files are byte-identical, and the delete hook (UserRepository.beginDeleteLifecycle) and PostCommitActionQueue already exist here.

What changed from the original

Nothing. The patch is identical to the one merged on main (same git patch-id --stable). Git auto-merged UserRepository.java with no conflict, and the rest applied as is. The only difference is the commit title.

Behavior change to note in the release notes

A bot token or personal access token that has an exp is now disconnected shortly after it expires, and a script using the socket has to reconnect itself. Tokens with no exp are unaffected, and so are sockets that have a session.

Verification

Run on this branch (a clean 2.1 worktree, 2.1.2): 238 unit tests, 0 failures, across WebSocketManagerTest, SocketAddressFilterTest, SocketAddressFilterSpoofRevalidationBypassTest, Jetty12WebSocketHandlerTest, PushFeedUserPresenceTest, OpenMetadataApplicationAuthReloadTest, UserRepositoryUnitTest, JwtFilterTest, CacheBundleTest, FeedServletTest and HeaderRequestWrapperTest. spotless:check passes and the openmetadata-integration-tests module compiles.

Not run here: the new integration tests (SsoPushFeedSocketIT, SessionMultiNodeIT), which CI does not run, and the Jest test for WebSocketProvider. Both were run by the author on main, and the files they cover are identical on 2.1 apart from constants.ts, where only one line is added.

…ken expires or their user is deleted (backport 2.1 #38876)
@manerow
manerow requested review from a team as code owners November 30, 2026 10:45
@manerow
manerow requested review from shah-harshit and sonika-shah and removed request for a team November 30, 2026 10:45
@manerow manerow added the skip-pr-checks Bypass PR metadata validation check label Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Enforces token expiry and user deletion for sessionless push-feed sockets, changing an authorization boundary where missed revocation could preserve stale access.

Backports the push feed socket lifetime fix to 2.1: sockets opened with sessionless tokens (SSO public client, bot, or PAT) now close after the token's exp and when their user is deleted, with a tokenExpiredChannel notice so the UI can reconnect with a renewed token. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@manerow
manerow merged commit 431ebd9 into 2.1 Nov 30, 2026
44 of 45 checks passed
@manerow
manerow deleted the fix/38245-sessionless-socket-lifetime-2.1 branch November 30, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants