Skip to content

Access control

Auth token saved in localStorageaccess.token-in-web-storage

Anything in localStorage or sessionStorage can be read by every script on the page. If one dependency or one XSS bug runs attacker code, the token is copied out and the account is taken over, even after the user closes the tab.

  • In force Rule access.token-in-web-storage
  • 3 clauses

At a glance

access.token-in-web-storage
Severitymedium
CertaintyNeeds review — a heuristic; confirm before changing code
Looks atyour source code
When it runsRuns on every scan

How to fix it

Keep the session in an HttpOnly, Secure, SameSite cookie set by your server (most auth libraries do this for you), or keep short-lived tokens in memory only.

Check your own app

Run npx scanlyfix scan in your project. Every finding gets an id; after fixing, npx scanlyfix verify <id> proves it is gone.

If it is a false positive in your project, silence that one line with // scanlyfix-ignore-next-line access.token-in-web-storage -- <why>.

All rules

Your code stays
on your machine

Only findings are uploaded, and only to your own dashboard.