-
Notifications
You must be signed in to change notification settings - Fork 538
Open
Labels
auth-jsRelated to the auth-js library.Related to the auth-js library.bugSomething isn't workingSomething isn't working
Description
The function supabase.auth.getSession() is basically a vulnerability in every Supabase app, a lot of people are currently using it in the server, telling users to use getUser in a warning as currently happens is not enough. It would also mean calling supabase API every time an user does a request, which slow everything down and makes the use of JWTs pointless.
What you could do instead is to validate the jwt inside getSession.
This change would require passing the jwt secret as an argument when creating the client, then you would log the warning if the user doesn't pass the jwt secret.
example:
const supabase = createServerClient(
env.PUBLIC_SUPABASE_URL!,
env.PUBLIC_SUPABASE_ANON_KEY!,
{
jwtSecret: process.env.SUPABASE_JWT_SECRET,
}
)giacomoran, nvergez, jepsn1, remorses, Vikaskumargd and 1 more
Metadata
Metadata
Assignees
Labels
auth-jsRelated to the auth-js library.Related to the auth-js library.bugSomething isn't workingSomething isn't working