fix: clear compose draft from localStorage on logout#279
Merged
hoiekim merged 1 commit intohoiekim:mainfrom Mar 25, 2026
Merged
fix: clear compose draft from localStorage on logout#279hoiekim merged 1 commit intohoiekim:mainfrom
hoiekim merged 1 commit intohoiekim:mainfrom
Conversation
Contributor
Author
Self-ReviewDiscussion thread status:
Changes:
Key decisions:
Risk: Low
|
Contributor
Author
Self-ReviewDiscussion thread status:
Checked:
E2E Testing:
Issues found:
Confidence: High |
Compose form fields (name, to, cc, bcc, subject, sender, initialContent, originalMessage, isCcOpen) are persisted to localStorage via useLocalStorage hooks. They were not cleared on logout, so a subsequent user on the same browser could see the previous user's unsent draft. Fix: on successful logout, remove all compose-related localStorage keys before clearing the session. This prevents draft data from leaking across user sessions. Closes hoiekim#277
e60ef9d to
e877659
Compare
hoiekim
approved these changes
Mar 25, 2026
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.
Summary
Fixes a privacy issue where compose form draft data persisted in
localStorageafter logout, allowing the next user on the same browser to see a previous user's unsent email draft.Root Cause
The compose form stores all fields in
localStorageviauseLocalStoragehooks:name,to,cc,bcc,subject,sender,initialContent,originalMessage,isCcOpenThe logout handler in
Accounts/index.tsxcalledsetUserInfo(undefined)andsetSelectedAccount("")but never cleared these compose keys, leaving draft data readable by the next user.Fix
Added
localStorage.removeItem()calls for all compose-related keys in theonClickLogouthandler, executed immediately after the server confirms the logout. This ensures no draft data persists across user sessions.Testing
to,subject,initialContentetc. are still presentCloses #277