Problem (defense-in-depth)
The auth JWT is stored in localStorage (auth_token) and attached via an axios interceptor and SSE/WS ?token= params. Any XSS in the SPA could read and exfiltrate the bearer token; the 7-day token lifetime (JWT_LIFETIME_SECONDS default 604800) widens the window.
No active XSS sink exists today (no dangerouslySetInnerHTML; react-markdown v10 with no rehype-raw is safe), so this is hardening, not an active exploit — but it pairs with the hosted/multi-user threat model.
Evidence
web-ui/src/lib/auth.ts:5 — token in localStorage
web-ui/src/components/sessions/AgentTerminal.tsx:12, web-ui/src/hooks/useAgentChat.ts:20 — ?token= usage
Fix
- Prefer an
HttpOnly, Secure, SameSite cookie for the session token where feasible.
- If
localStorage must stay (EventSource header limitation drove the ?token= design), shorten token lifetime + add refresh, and add a strict Content-Security-Policy to contain any future XSS.
Acceptance criteria
Source: release-readiness audit 2026-06-13 (security agent, finding M3). Defense-in-depth; prioritize alongside hosted readiness.
Problem (defense-in-depth)
The auth JWT is stored in
localStorage(auth_token) and attached via an axios interceptor and SSE/WS?token=params. Any XSS in the SPA could read and exfiltrate the bearer token; the 7-day token lifetime (JWT_LIFETIME_SECONDSdefault 604800) widens the window.No active XSS sink exists today (no
dangerouslySetInnerHTML;react-markdownv10 with norehype-rawis safe), so this is hardening, not an active exploit — but it pairs with the hosted/multi-user threat model.Evidence
web-ui/src/lib/auth.ts:5— token inlocalStorageweb-ui/src/components/sessions/AgentTerminal.tsx:12,web-ui/src/hooks/useAgentChat.ts:20—?token=usageFix
HttpOnly,Secure,SameSitecookie for the session token where feasible.localStoragemust stay (EventSource header limitation drove the?token=design), shorten token lifetime + add refresh, and add a strict Content-Security-Policy to contain any future XSS.Acceptance criteria
Source: release-readiness audit 2026-06-13 (security agent, finding M3). Defense-in-depth; prioritize alongside hosted readiness.