feat(security): implement cryptographic token signing wrapper#2256
Merged
janavipandole merged 1 commit intoJun 14, 2026
Merged
Conversation
|
@Prateek2007-cmd is attempting to deploy a commit to the janavipandole's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Description
This PR resolves Issue 4: Missing Cryptographic Token Signing.
Closes #2250
The
secure-storage.jsutility previously used a very basic XOR cipher with a hardcoded key to obscure tokens in local storage. This offered virtually zero security against data tampering. This PR replaces the naive XOR obfuscation with a robust HMAC-SHA256 signature generated using the native Web Crypto API (window.crypto.subtle).While client-side storage is inherently accessible to the user, this approach guarantees data integrity (tamper evidence) by invalidating any modified local storage entries and fulfills the technical requirement of the previously pending
TODO.Changes Made
getKey(),signData(), andverifyData()utility functions using thewindow.crypto.subtleAPI.SecureStorage.setItemto asynchronously generate an HMAC signature and store the payload and signature together.SecureStorage.getItemto verify the signature of the payload before returning the data. If the signature is invalid, it logs a warning, purges the tampered data, and returnsnull.TODO: Implement cryptographic token signing wrappercomment.Type of Change