-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Redesign WSLA Session management #14067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/wsl-for-apps
Are you sure you want to change the base?
Conversation
…oneblue/session-manager
There was a problem hiding this 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 redesigns WSLA session management from a per-user session model to a global SessionManager. The change enables sessions to be accessed across Windows users with proper access control, replacing WSLAUserSession with WSLASessionManager throughout the codebase.
Changes:
- Replaced per-user
WSLAUserSessionwith globalWSLASessionManagerfor centralized session management - Added access control logic to prevent non-elevated tokens from accessing elevated sessions
- Introduced
COMImplClasshelper template to standardize COM-to-implementation forwarding - Updated
GetNonElevatedTokento accept aTOKEN_TYPEparameter for flexible token generation
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/windows/wslaservice/inc/wslaservice.idl |
Renamed IWSLAUserSession to IWSLASessionManager, added GetId() method to IWSLASession, and added Sid field to session information |
src/windows/wslaservice/exe/WSLASessionManager.h/.cpp |
New global session manager implementation with token-based access control |
src/windows/wslaservice/exe/WSLASessionManagerFactory.h/.cpp |
Factory for singleton session manager instance |
src/windows/wslaservice/exe/WSLASession.h/.cpp |
Added session creator tracking (PID, SID, elevation status) |
src/windows/wslaservice/exe/COMImplClass.h |
New helper template for COM-to-implementation forwarding pattern |
src/windows/wslaservice/exe/WSLAContainer.h/.cpp |
Refactored to use COMImplClass base template |
test/windows/Common.h/.cpp |
Updated GetNonElevatedToken to accept TOKEN_TYPE parameter |
test/windows/WSLATests.cpp |
Updated tests for new session manager API and added elevation access control tests |
src/windows/common/WslClient.cpp |
Updated to use IWSLASessionManager |
src/windows/wsladiag/wsladiag.cpp |
Updated to use IWSLASessionManager |
| { | ||
| wil::com_ptr<IWSLAUserSession> userSession; | ||
| VERIFY_SUCCEEDED(CoCreateInstance(__uuidof(WSLAUserSession), nullptr, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&userSession))); | ||
| wil::com_ptr<IWSLASessionManager> userSession; |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable is named userSession but now represents a global session manager, not a per-user session. Rename to manager or sessionManager for clarity and consistency with the rest of the test.
| { | ||
| wil::com_ptr<IWSLAUserSession> userSession; | ||
| VERIFY_SUCCEEDED(CoCreateInstance(__uuidof(WSLAUserSession), nullptr, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&userSession))); | ||
| wil::com_ptr<IWSLASessionManager> userSession; |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable is named userSession but now represents a global session manager, not a per-user session. Rename to manager or sessionManager for clarity and consistency with the rest of the test.
|
|
||
| wil::com_ptr<IWSLAUserSession> userSession; | ||
| VERIFY_SUCCEEDED(CoCreateInstance(__uuidof(WSLAUserSession), nullptr, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&userSession))); | ||
| wil::com_ptr<IWSLASessionManager> userSession; |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable is named userSession but now represents a global session manager, not a per-user session. Rename to manager or sessionManager for clarity and consistency with the test at line 2361.
|
|
||
| wil::com_ptr<IWSLAUserSession> userSession; | ||
| VERIFY_SUCCEEDED(CoCreateInstance(__uuidof(WSLAUserSession), nullptr, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&userSession))); | ||
| wil::com_ptr<IWSLASessionManager> userSession; |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable is named userSession but now represents a global session manager, not a per-user session. Rename to manager or sessionManager for clarity and consistency with the test at line 2361.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| } | ||
|
|
||
| wil::unique_handle GetNonElevatedToken() | ||
| wil::unique_handle GetNonElevatedToken(TOKEN_TYPE Type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big thanks to @johnstep for his help in getting this right
Summary of the Pull Request
This change redesigns our per user session management logic into a global SessionManager.
This allows sessions to be interacted across Windows users.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed