fix: resolve clear-text storage of encryption secrets#2
Merged
Conversation
- Add SecureStorage wrapper to encrypt sensitive data before localStorage - Replace plain-text user secret storage with encrypted storage - Generate session-based encryption keys (cleared on page reload) - Update clearUserData to remove both encrypted and legacy plain-text secrets - Automatically migrate from legacy plain-text storage to encrypted storage This resolves the CodeQL security alert (js/clear-text-storage-of-sensitive-data) by ensuring all encryption secrets are encrypted before being stored in localStorage. Security improvements: - Session-based encryption keys (memory-only, cleared on reload) - Automatic cleanup of corrupted/legacy storage - Secure session clearing on logout - No breaking changes to existing functionality
Contributor
|
🎉 This PR is included in version 1.10.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
🔐 Security Issue
Resolves CodeQL security alert: js/clear-text-storage-of-sensitive-data
The encryption service was storing sensitive user secrets in plain text in
localStorage, making them accessible to attackers who gain access to browser
storage.
Vulnerability Details
Before (Vulnerable):
// Plain text storage - security risk
localStorage.setItem(storageKey, secret);
this.userSecrets.set(userId, secret);
After (Secure):
// Encrypted storage with session-based keys
await secureStorage.setSecureItem(storageKey, secret);
this.userSecrets.set(userId, secret); // Memory cache only
Security Improvements
New SecureStorage Module
page reload
Enhanced Data Protection
🧪 Testing
Files Changed
🎯 Impact
This fix ensures compliance with security best practices by encrypting all
sensitive data before storage, while maintaining full backward compatibility and
performance.