Securing Next.js + Supabase, in depth
The specific mistakes that get apps on this stack hacked — and the exact fix for each. No generic checklists.
- ·7 min read
Your Supabase RLS is enabled and still wide open: the USING (true) trap
RLS being enabled doesn't mean it protects anything. A policy with USING (true) returns every row to every caller.
SupabaseRLSPostgresSecurity - ·6 min read
Hardcoding your Supabase service_role JWT is a permanent breach, even after you delete it
Pasting the service_role JWT (eyJ...) straight into source bypasses every RLS policy and lives in git history forever. Here's why, and the exact fix.
SupabaseSecretsJWTGit - ·8 min read
Every Supabase table needs RLS — the one you forgot is public
New Supabase tables ship with RLS off. The one table you forgot to enable it on is readable by anyone holding your anon key. How to catch it.
SupabaseRLSPostgresMigrations - ·6 min read
Vulnerable npm dependencies: catch them before they ship, not after
Most breaches start in node_modules, not your code. Here's how known-vulnerable npm packages slip past review — and how to stop them at the PR.
npmDependenciesNext.jsSupply Chain - ·5 min read
Your Supabase service role key is one NEXT_PUBLIC_ away from a full database breach
The Supabase service_role key bypasses every RLS policy. Here's exactly how it leaks into the browser, why it's catastrophic, and the precise fix.
SupabaseRLSSecretsNext.js