4
Changing JWTs to RS256 to verify JWT inside getSession() anywhere
Source: supabase/supabase#28873 · opened by @gc-ft
Hi, right now the supabase JWTs use HS256 for encryption. This means that in order to verify the JWT fully we need the JWT secret, which in turn means that the best way to verify the JWT right now is to query supabase.auth.getUser() which retrieves the user from the auth backend while checking the JWT is ok. getSession() does (as the discussions around the warnings it can generate in connection with SSR) NOT verify the JWT. Therefore the JWT payload could be modified, without changing the JWT signature and you would never know. Having to run supabase.auth.getUser() on every server request or possibly more often is however not very cost-effective and takes time. Is the best solution not to change Supabase's JWT to RS256 or RS512, which would result in a private key to generate the signature but a public key to verify it! This would mean it would be totally ok to release the public key even inside the client facing code, allowing both server and client to use getSession() …
No pledges yet. Be the first to back this.
Comments
Similar requests
Request to Enable External JWT Authentication with Firebase (Project: dropnow-2025)
1 vote · 0 comments
Asymmetric cryptography
3 votes · 0 comments
Email Verification API support with SD-JWT for native email verification
2 votes · 0 comments
Send provider name back when using Providers
1 vote · 0 comments
Make auth JWTs http-only cookies (by default)
11 votes · 0 comments
No comments yet.