What it finds on a demo project

The audit looks for auth tokens kept in localStorage or sessionStorage, session cookies set without HttpOnly, Secure or SameSite, and forms that use cookie authentication with no CSRF check.

SiteCMD CLI 2.0.0
Demo project: Login route and sign-in component
npx sitecmd audit .
SiteCMD Code Scan - .
Checked: November 9, 2026
Framework: React
Issues: 3 total | critical 0 | high 1 | medium 2 | low 0

High (1)
- [Security · security] No recognized local CSRF defense for a cookie-backed write - src/routes/login.js:12

Medium (2)
- [Security · security] Browser storage uses an authentication-like key - src/components/Login.jsx:7
- [Security · security] Cookie write lacks recognized explicit session hardening flags - src/routes/login.js:12

Your code passes? Now watch your site.

Join the waitlist

Compare localStorage and cookies for storing a JWT

An HttpOnly cookie keeps its value out of JavaScript cookie APIs. Page code can't read it, but the browser can still send it with requests. MDN's cookie reference explains the attribute.

Plan CSRF protection when you store a JWT in a cookie

For actions that use cookie authentication, use your framework's CSRF defense or a suitable token or origin check validated on the server. Moving a credential into a cookie doesn't decide which cross-site requests the server should accept. Follow OWASP's CSRF guidance.

See where Supabase and Auth0 store browser tokens

  • The Supabase JavaScript client sets persistSession to true by default and attempts to store the session in localStorage.

  • The Auth0 SPA SDK stores tokens in memory by default. If you set cacheLocation to localstorage, that storage persists across page refreshes and browser tabs.

Frequently asked questions

Is localStorage safe for auth tokens?

A successful same-origin script injection can read those tokens. OWASP advises against keeping session identifiers in localStorage. Review the storage and session design your auth library supports before changing where you keep credentials.

  • Website security

    Catch leaked API keys and exposed files before someone uses them against you.

  • JWT decode vs verify

    Separate reading a token from deciding whether to trust its claims.

  • Cookie security

    Choose cookie attributes that fit your sign-in flow and limit unnecessary exposure.

Confirm you're a person