~/talk

Token Security in Single Page Applications

Talkat sec4dev 2021 · 2021-02-22..02-25· [security, web-platform]
slides:none on file

Explains that localStorage persists across tabs and restarts and is trivially readable by any same-origin script so XSS can steal access and refresh tokens; demonstrates extracting stored tokens by setting an image src to exfiltrate JSON. Shows refresh token rotation (one-time use) reduces attacker window but fails if malicious script continues to act like the user. Recommends isolating token handling in a worker or, better, a backend‑for‑frontend that keeps tokens on the server, and focuses on preventing XSS rather than vague promises.

AI-written summary · about

  1. 0:00Introduction to token storage
  2. 2:10Local storage security risks
  3. 8:31Cookie security and XSS attacks
  4. 15:32Token theft scenarios
  5. 23:16Frontend security with BFF pattern
  6. 27:53Preventing JavaScript execution attacks
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.