Draft
Conversation
|
|
||
| if (clearLoginDetails) { | ||
| this.storageHelper.clearStorage(`torus_login_${instanceId}`); | ||
| this.sessionManager.clearStorage(); |
There was a problem hiding this comment.
Missing sessionId set before clearStorage in success path
High Severity
When storageData is provided to getRedirectResult, the if (!loginDetails) block is skipped, so this.sessionManager.sessionId is never set for the current instanceId. The success-path clearStorage() call then operates on a stale or default sessionId, failing to clear the correct session data. The error path at lines 316–317 correctly sets sessionId before calling clearStorage(), but the success path omits this. The old code always passed the key explicitly to clearStorage, so both paths worked.
Additional Locations (1)
| nodeDetailManager: NodeDetailManager; | ||
|
|
||
| storageHelper: StorageHelper<LoginDetails>; | ||
| useLocalStorage: boolean = true; |
Member
There was a problem hiding this comment.
no need for flag. always true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Motivation and Context
Jira Link: https://consensyssoftware.atlassian.net/browse/W3APD-5312?atlOrigin=eyJpIjoiNDU0MDYyNWQ2MWExNGQxNjhkMzFiYTQxYzI5N2I2ZDUiLCJwIjoiaiJ9
Description
This PR migrates redirect-session persistence in CustomAuth from StorageHelper to SessionManager, while preserving compatibility with existing stored session keys.
Align src/utils/sessionHelper.ts with the same behavior by adding useLocalStorage: true.
How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Note
Medium Risk
Changes the redirect login flow’s state persistence and retrieval path; any mismatch in session ID hashing, storage availability, or session cleanup could break redirect logins across browsers/environments.
Overview
Redirect-mode login state persistence is migrated from the internal
StorageHelperto@toruslabs/session-managerinCustomAuth, including orphan cleanup, session creation before redirect, and session authorization/cleanup when handling the redirect result.To preserve legacy keying, a new
getSessionId()hashes the previous string storage key into the hexsessionIdformat expected bySessionManager, and logging/error messaging is updated to report whetherlocalStorageor server storage was used.fetchDataFromBroadcastServeris also updated to explicitly setuseLocalStorage: true.Written by Cursor Bugbot for commit 940ebb5. This will update automatically on new commits. Configure here.