2026-11-15 · Daily security tips
Does your server trust a login token without checking it?
A lot of AI-written server code reads the user straight from the session cookie and trusts it. In Supabase, supabase.auth.getSession() in server code or middleware only reads what is in the cookie. It does not ask Supabase whether the token is real, and the cookie is something the visitor controls. jwt.decode() in Node has the same problem: it reads a token without checking its signature.
Check: search your middleware, API routes and server actions for getSession( and jwt.decode(. If either one decides who the user is or what they can see, that check can be faked.
Fix: on the server use supabase.auth.getUser() or getClaims(), which validate the token, and jwt.verify() instead of jwt.decode(). Keep RLS on as a second layer.