Skip to content

dbeaver/cloudbeaver#4249 added session rotation#4274

Open
Nexus6v2 wants to merge 13 commits intodevelfrom
dbeaver/cloudbeaver#4249-session-id-rotation
Open

dbeaver/cloudbeaver#4249 added session rotation#4274
Nexus6v2 wants to merge 13 commits intodevelfrom
dbeaver/cloudbeaver#4249-session-id-rotation

Conversation

@Nexus6v2
Copy link
Copy Markdown
Contributor

@Nexus6v2 Nexus6v2 commented Apr 8, 2026

Closes #4249

@Nexus6v2 Nexus6v2 self-assigned this Apr 8, 2026
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 8, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@Nexus6v2 Nexus6v2 requested a review from HocKu7 April 8, 2026 11:15
yagudin10
yagudin10 previously approved these changes Apr 14, 2026
@Nexus6v2 Nexus6v2 force-pushed the dbeaver/cloudbeaver#4249-session-id-rotation branch from 668341b to 0ae568d Compare April 23, 2026 09:51
yagudin10
yagudin10 previously approved these changes Apr 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements session rotation during authentication to mitigate session fixation attacks (per #4249) by introducing a rotateSession helper and wiring HttpServletRequest into the auth login flows.

Changes:

  • Added CBSessionManager.rotateSession(...) and event-handler migration support in BaseWebSession.
  • Updated auth service API/binding to pass HttpServletRequest into authLogin, and rotated the session at the start of authLogin/federatedLogin.
  • Minor refactors/copyright year updates.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/impl/WebServiceAuthImpl.java Rotates session during authLogin and federatedLogin attempts.
server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/WebServiceBindingAuth.java Passes servlet request into authLogin via GraphQL wiring.
server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/DBWServiceAuth.java Extends authLogin signature to include HttpServletRequest.
server/bundles/io.cloudbeaver.server.ce/src/io/cloudbeaver/service/session/CBSessionManager.java Adds rotateSession implementation and small findWebSession refactor.
server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/session/BaseWebSession.java Adds event handler migration method used during rotation.
server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/handler/WSAuthSessionEventHandler.java Copyright year update.
server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/WebAsyncAuthJob.java Copyright year update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

boolean forceSessionsLogout
) throws DBWebException {
try {
// Rotate web session during each login attempt to prevent session fixation attacks
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this is an additional login (e.g. AWS)?
The same for federatedLogin.

Copy link
Copy Markdown
Contributor Author

@Nexus6v2 Nexus6v2 Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question.
My guess is session should also be rotated for additional logins, since we would have the same vulnerability:

  1. User logs in
  2. Session cookie is compromised
  3. User does additional login
  4. Compromised session cookie gains access to new auth

Rotated session should also keep the existing auth

I will update the PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided on the call to keep rotation only for the first login (anonymous only)

}
}

public void migrateEventHandlersTo(@NotNull BaseWebSession target) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will it work in case of multi-node env?
And why do we need to migrate event handlers at all? Generally new login means that old session is no more valuable, we should just close it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will it work in case of multi-node env?

I believe it will only be different in case if sticky-sessions routing based on this cookie is used. As far as I know it's not, so it should behave the same.

And why do we need to migrate event handlers at all? Generally new login means that old session is no more valuable, we should just close it

There is an open web socket that we need to migrate to new session, otherwise the flow breaks and UI waits for auth with an endless spinner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No session rotation on login

5 participants