Problem
The auth store persists token to browser storage via Zustand persist.
Code references
packages/client/src/stores/auth.ts
persist(...) wrapper
partialize includes token
Why it matters
If any XSS occurs, localStorage-stored bearer tokens are straightforward to exfiltrate, increasing account/session takeover risk.
Proposed approach
- Remove
token from persisted state (partialize).
- Keep token in-memory only, and rely on secure httpOnly cookie session or silent refresh endpoint for continuity.
- Preserve low-risk preferences in storage (
user snapshot if needed, model prefs), but not bearer credentials.
Acceptance criteria
Problem
The auth store persists
tokento browser storage via Zustandpersist.Code references
packages/client/src/stores/auth.tspersist(...)wrapperpartializeincludestokenWhy it matters
If any XSS occurs,
localStorage-stored bearer tokens are straightforward to exfiltrate, increasing account/session takeover risk.Proposed approach
tokenfrom persisted state (partialize).usersnapshot if needed, model prefs), but not bearer credentials.Acceptance criteria