🔴 CRITICAL: Fix password storage vulnerability (CWE-312) #1263#1266
Open
Harshit2405-2004 wants to merge 1 commit intoRocketChat:developfrom
Open
🔴 CRITICAL: Fix password storage vulnerability (CWE-312) #1263#1266Harshit2405-2004 wants to merge 1 commit intoRocketChat:developfrom
Harshit2405-2004 wants to merge 1 commit intoRocketChat:developfrom
Conversation
SECURITY FIX - CWE-312: Cleartext Storage of Sensitive Information Issue: RocketChat#1263 Changes: - Removed password field from userStore (React + React Native) - Created ephemeral totpCredentialsStore for TOTP flow - Credentials stored temporarily (seconds) during 2FA, cleared immediately - Updated useRCAuth hook to use ephemeral credentials - Updated TotpModal to retrieve from ephemeral store - Added automatic cleanup on success/error/modal close Security Impact: ✅ Passwords no longer exposed in React DevTools ✅ No persistent client-side password storage ✅ Automatic credential cleanup prevents exposure ✅ Ephemeral storage pattern for sensitive data Modified Files: - packages/react/src/store/userStore.js - packages/react-native/src/store/userStore.js - packages/react/src/hooks/useRCAuth.js - packages/react/src/views/TotpModal/TwoFactorTotpModal.js - packages/react/src/store/index.js New Files: - packages/react/src/store/totpCredentialsStore.js Updated: - .gitignore (prevent committing local analysis files) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6e57549 to
6c3dbe3
Compare
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.
🔴 CRITICAL Security Fix
Fixes #1263 - Plain-text Password Storage Vulnerability (CWE-312)
📋 Summary
This PR removes password storage from the global Zustand state to fix a critical security vulnerability where user passwords were exposed in browser memory and React DevTools.
🔒 Security Impact
Before (Vulnerable)
After (Secure)
🔧 Changes Made
1. Removed Password from Global State
Files:
2. Created Ephemeral Credentials Store
New File: packages/react/src/store/totpCredentialsStore.js
Temporary store that:
3. Updated Authentication Hook
File: packages/react/src/hooks/useRCAuth.js
Changes:
4. Updated TOTP Modal
File: packages/react/src/views/TotpModal/TwoFactorTotpModal.js
Changes:
5. Exported New Store
File: packages/react/src/store/index.js
✅ Testing
Manual Testing Completed:
🎯 Migration Notes
Breaking Changes: None - This is an internal security fix
Backward Compatibility: Fully backward compatible
📊 Impact Analysis
Files Changed: 5 modified, 1 created
Risk Level: LOW - Internal state management only
User Impact: POSITIVE - Improved security with no UX changes
Security Severity: CRITICAL (CWE-312)
Fix Timeline: Within 24 hours (requirement met)