Supabase · sdk · fg-0197

Server logs fill with Using the user object as returned from supabase.auth.getSession() could be insecure

If you see Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure, the cause and the fix for Supabase are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecureWarning appears even though your code never calls getSessionShows on every request in Next.js middleware or server components using @supabase/ssr
Cause
On the server, the session comes from cookies the client can forge, so the library wraps session.user in a proxy that warns on first access. Library internals and your own route guards that read session.user trigger it.
Fix
Use getClaims() to verify the JWT, or getUser() to ask the Auth server, whenever an identity decision is made on the server. Read only the access token from getSession, never the user object.
Apply
const { data, error } = await supabase.auth.getClaims(); if (error || !data) return redirect('/login'); const userId = data.claims.sub;
Affected
Server-side clients from @supabase/auth-js (gotrue-js) 2.63.0, released 2024-03-26, onward, as bundled in @supabase/supabase-js and used by @supabase/ssr
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun