Buscar

Objetos taggeado con: RLS

60-second Supabase check. Paste this in the SQL Editor:

select relname from pg_class where relnamespace = 'public'::regnamespace and relkind = 'r' and not relrowsecurity;

Every table it lists has RLS off. If anon still has its grants (the default on older projects), anyone with your public key can read, insert, update and delete rows.

Fix: alter table public.x enable row level security; then add policies scoped to auth.uid().

#Supabase #PostgreSQL #Postgres #RLS #vibecoding #AppSec #webdev

Common one in AI-built apps: an RLS error shows up, the agent swaps in the service_role key in the API route, the error goes away.

That key skips RLS. Now /api/orders/[id] returns whatever id it's given, to anyone signed in.

Fix: filter by id AND user_id from the server-side session (never from the request body), or create the Supabase client with the user's session so your policies apply.

#Supabase #AppSec #infosec #nextjs #postgres #RLS #vibecoding #webdev #IDOR

60-second Supabase check, SQL Editor:

select tablename, policyname, cmd, qual from pg_policies where qual ilike '%auth.role()%' or qual ilike '%auth.uid() is not null%' or qual = 'true';

Each row is a policy that only checks "is someone signed in" (or nothing at all). On profiles, orders, messages or uploads, swap it for (select auth.uid()) = user_id.

#Supabase #Postgres #PostgreSQL #SQL #RLS #AppSec #vibecoding #webdev #infosec #security #buildinpublic #indiehackers #Lovable #Bolt #Cursor

A Supabase RLS policy written as "to authenticated using (true)", or using (auth.role() = 'authenticated'), doesn't mean "the right user". It means anyone with an account.

And with "Allow new users to sign up" on (the default), anyone can make one with the public key in your JS. Anonymous sign-ins get the authenticated role too.

One query to find these, and the auth.uid() fix: abbilabs.xyz/guides/supabase-authenticated-role-any-signed-up-user

#Supabase #RLS #vibecoding #AppSec #Postgres #webdev #buildinpublic #indiehackers #infosec

Question for anyone with Supabase anonymous sign-ins turned on: did you go back through your policies?

Anonymous users use the same authenticated Postgres role as real accounts. So "to authenticated using (true)" now means anyone who opens the app, no email needed.

auth.jwt()->>'is_anonymous' is how you tell them apart in a policy.

#Supabase #RLS #PostgreSQL #Postgres #AppSec #vibecoding #webdev #auth #SQL #infosec #database #Lovable

Supabase tip: got a view over a table you locked down with RLS? By default Postgres runs a view with its creator's rights, on Supabase usually the postgres role, which skips RLS. So the view can hand every row to anyone with your anon key.

The Security Advisor flags it as "Security Definer View". Fix on Postgres 15+:
alter view your_view set (security_invoker = true);

abbilabs.xyz/tips/supabase-views-bypass-rls

#Supabase #PostgreSQL #Postgres #RLS #SQL #AppSec #infosec #vibecoding

Built a live chat on Supabase Realtime? Check two permission systems.

Postgres Changes follows your table's RLS select policies, so a using (true) policy streams every new row to anyone holding your anon key.

Broadcast and Presence only check realtime.messages policies on channels joined with private: true, and only once "Allow public access" is off.

Queries + a signed-out test:
abbilabs.xyz/guides/supabase-realtime-authorization-private-channels

#Supabase #Realtime #PostgreSQL #RLS #vibecoding #webdev #AppSec

I built a free in-browser Supabase RLS policy checker.

You run one read-only query in the SQL editor, paste the result, and it points out things like using (true), with check (true), and write policies with no owner check. The analysis runs in your browser.

It's for the write side, which an outside scan can't test.

abbilabs.xyz/tools/supabase-policy-checker

#Supabase #RLS #Postgres #AppSec #webdev #vibecoding #SaaS #indiehackers #devtools #Lovable #Bolt