feat: implement PKCE code_verifier storage in sessionStorage for brow…#509
Open
nadeem-cs wants to merge 1 commit intodevelopmentfrom
Open
feat: implement PKCE code_verifier storage in sessionStorage for brow…#509nadeem-cs wants to merge 1 commit intodevelopmentfrom
nadeem-cs wants to merge 1 commit intodevelopmentfrom
Conversation
…ser SPAs - Added `pkceStorage.js` module to handle code_verifier persistence. - Updated `OAuthHandler` to utilize sessionStorage for storing and retrieving code_verifier. - Enhanced token exchange process to clear code_verifier on success or error to prevent replay attacks. - Added unit tests for PKCE storage functionality.
|
Coverage report for commit: 36ce251 Summary - Lines: 82.46% | Methods: 95.88% | Branches: 68.29%
🤖 comment via lucassabreu/comment-coverage-clover |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
aman19K
reviewed
Feb 20, 2026
| codeVerifier, | ||
| expiresAt: Date.now() + PKCE_STORAGE_EXPIRY_MS | ||
| }) | ||
| window.sessionStorage.setItem(key, value) |
Contributor
There was a problem hiding this comment.
@nadeem-cs , can we use httpcookies instead of session storage? Session storage might create security issue.
Contributor
Author
There was a problem hiding this comment.
@aman19K Actually using sessionStorage is more recommended approach for the issue we're trying to resolve here - browser compatibility. It does not give any security concern. It will be only risky if the app has XSS bug , only then it can read the session cookie. Otherwise this is more recommended approach.
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.
…ser SPAs
pkceStorage.jsmodule to handle code_verifier persistence.OAuthHandlerto utilize sessionStorage for storing and retrieving code_verifier.