Skip to content

Conversation

@tjementum
Copy link
Member

Summary & Motivation

Add user session management functionality allowing users to view and revoke active sessions across all devices and accounts. Sessions are queried across all accounts for the user's email address using unfiltered repository methods and displayed with device information, browser details, IP address, and account name in a modal dialog accessible from the user menu. Each session can be individually revoked with confirmation dialogs to prevent accidental sign-outs. Session revocation validates ownership by email instead of user ID, ensuring users can revoke sessions across all their accounts.

The implementation includes a critical security fix discovered during development:

  • Fix session lifetime extension vulnerability: Switching accounts previously created a new 90-day session, allowing infinite session extension. Current session is now revoked when switching accounts, and the new session preserves the original expiry date through a computed ExpiresAt property on the Session aggregate and token generation overloads that accept custom expiry parameters.

Backend changes include session revocation endpoints with tests, repository methods for unfiltered session queries, SwitchTenant added to SessionRevokedReason enum, and RefreshTokenGenerator.ValidForHours made public as the single source of truth. Frontend changes include SessionsModal component with device type detection, user agent parsing, Smart Date formatting, confirmation dialogs, and E2E tests covering session viewing, individual revocation, and cross-account scenarios.

Checklist

  • I have added tests, or done manual regression tests
  • I have updated the documentation, if necessary

@tjementum tjementum self-assigned this Jan 7, 2026
@tjementum tjementum added Bug Something isn't working Enhancement New feature or request labels Jan 7, 2026
@linear
Copy link

linear bot commented Jan 7, 2026

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 7, 2026

@tjementum tjementum merged commit 5536c05 into main Jan 7, 2026
28 checks passed
@tjementum tjementum deleted the pp-747-frontend-for-session-management branch January 7, 2026 01:53
@github-project-automation github-project-automation bot moved this to ✅ Done in Kanban board Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants