Supabase Realtime security: who can listen to your channels and table changes
By Abbi Labs · Last updated 19 November 2026
Scan your app free — see which Supabase tables a signed-out stranger can read right now.
Abbi Labs checks your live site from the outside: Supabase tables readable with your public key, role-looking columns exposed to the anon role, secret keys in the JavaScript, exposed .env and .git files, source maps, and security headers. Read-only. No sign-up for the quick check.
No app handy?
No sign-up. Read-only public-resource and protocol metadata checks. No model prompts or tool execution. Scan only sites you own or are allowed to test.
Run on every deploy or use from Cursor / Claude Code via MCP →
Weekly AI-app security checklist
One short email a week: a practical check for apps built with Supabase, Next.js and AI tools (RLS, leaked keys, headers and more). Unsubscribe anytime.
Live chat, notifications, a "who's online" list, a dashboard that updates by itself. AI builders reach for Supabase Realtime for all of these, and the code they write usually works on the first try. The security part is easy to miss because Realtime has two separate permission systems:
- Postgres Changes (listening to inserts, updates and deletes on a table) follows the table's RLS select policies. Whatever a client can read, it can also watch live.
- Broadcast and Presence (messages and online status on a channel) follow RLS policies on
realtime.messages, but only on channels joined as private. Public channels aren't checked at all.
So the two questions are: which tables stream to someone holding only your public key, and which channels can a stranger join. Facts below are from Supabase's Realtime Authorization and Postgres Changes docs, checked 19 November 2026.
1. Which tables are streaming, and who can read them
Postgres Changes only sends events for tables in the supabase_realtime publication. Run this in the SQL Editor to list them with their RLS status and whether anon has select:
select p.schemaname, p.tablename,
c.relrowsecurity as rls_on,
has_table_privilege('anon', c.oid, 'SELECT') as anon_can_select,
has_table_privilege('authenticated', c.oid, 'SELECT') as authenticated_can_select
from pg_publication_tables p
join pg_class c on c.relname = p.tablename
join pg_namespace n on n.oid = c.relnamespace and n.nspname = p.schemaname
where p.pubname = 'supabase_realtime'
order by 1, 2;Then look at the select policies on those tables:
select schemaname, tablename, policyname, roles, qual
from pg_policies
where cmd in ('SELECT', 'ALL')
and (schemaname, tablename) in (
select schemaname, tablename from pg_publication_tables where pubname = 'supabase_realtime')
order by 1, 2;Anything with rls_on = false and a select grant, or a policy whose qual is true for anon or public, streams every change to anyone who has your public key, which is everyone who loads your site. Supabase's own quick start creates exactly that ("Allow anonymous access" with using (true)) and warns to secure it in production. AI-generated chat apps often copy it.
Two more details from the Postgres Changes docs:
- Deletes aren't filtered by RLS. The docs say RLS policies are not applied to DELETE events, because Postgres can't check access to a row that no longer exists. Assume subscribers of a table can see that a delete happened, and think before setting
replica identity full(which adds old values to update and delete events) on a sensitive table. - The
filteroption isn't security.filter: 'user_id=eq.123'is written in client code, so anyone can delete it in their own browser. Only the select policy limits what they receive.
Fix: give each streamed table a select policy scoped to the user, for example using ((select auth.uid()) = user_id), or membership in a room table. Remove tables from the publication if nothing in the app listens to them: alter publication supabase_realtime drop table public.your_table;
2. Make Broadcast and Presence channels private
By default, anyone with your public key who knows (or guesses) a channel name like room-1 can join it, read its broadcasts, send messages and see who's online. Locking it takes three things, all from Supabase's docs:
- Policies on
realtime.messages.selectcontrols receiving,insertcontrols sending. Userealtime.topic()for the channel name andextensionto tell broadcast from presence. private: truewhen the client joins the channel. Without it, the policies aren't used.- Turn off "Allow public access" in Realtime Settings in the dashboard. The docs say this is required to enforce private channels; otherwise a client can just join without
private: true.
A membership-based pair of policies, close to the example in Supabase's docs:
create policy "members can receive on their rooms"
on realtime.messages for select to authenticated
using (
exists (
select 1 from public.rooms_users
where user_id = (select auth.uid())
and room_topic = (select realtime.topic())
)
and realtime.messages.extension in ('broadcast', 'presence')
);
create policy "members can send on their rooms"
on realtime.messages for insert to authenticated
with check (
exists (
select 1 from public.rooms_users
where user_id = (select auth.uid())
and room_topic = (select realtime.topic())
)
and realtime.messages.extension in ('broadcast', 'presence')
);const channel = supabase.channel('room-1', { config: { private: true } })Make sure rooms_users itself can't be written by users, or anyone can add themselves to any room. Don't add alter table realtime.messages enable row level security to the migration: RLS is already on, and the statement fails with "must be owner of table messages", which aborts every policy after it. To see what you have now:
select policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'realtime' and tablename = 'messages';No rows means no channel is private yet. A policy that's just using (true) for authenticated means any signed-in user can join any private channel, and with open sign-ups that's anyone with an email address.
3. Revoking access isn't instant
Realtime works out a client's permissions when it subscribes and caches them for the connection. The docs say a user you remove from a room keeps receiving messages until their JWT expires or the client sends a new one. Keep the JWT expiry short (Auth settings), and if you're kicking someone out of something sensitive, also end their session.
4. Test it signed out, from your own site
Open your live site in a private window without signing in, open the console, and use the Supabase client the page already loaded (or create one with your public URL and anon key). Try to join a channel you think is private:
const ch = supabase.channel('room-1', { config: { private: true } })
ch.subscribe((status, err) => console.log(status, err))
// locked: CHANNEL_ERROR (or no SUBSCRIBED) while signed outThen listen to a table that should be private, and insert a row into it from a different, signed-in account:
supabase.channel('probe')
.on('postgres_changes', { event: '*', schema: 'public', table: 'messages' },
(payload) => console.log('got', payload))
.subscribe((status) => console.log(status))If got prints while you're signed out, that table is streaming to the public. Repeat signed in as a second test user to check they only receive their own rows. Only test your own project.
A prompt for Lovable, Bolt or Cursor
List every Supabase Realtime channel and postgres_changes subscription in this app. For each table in the supabase_realtime publication, show its RLS select policies and tell me if anon or any signed-in user could receive rows that aren't theirs. Rewrite those select policies to scope rows to the owner or room membership, and drop tables from the publication that nothing listens to. For Broadcast and Presence, switch every channel to { config: { private: true } } and write realtime.messages select and insert policies based on a membership table users can't write to. Don't add "alter table realtime.messages enable row level security". Remind me to turn off "Allow public access" in Realtime Settings.What an outside scan can and can't see
Abbi Labs checks from the outside and never writes to your database. It reports tables your public key can read, and a table readable that way is also one anyone can stream through Postgres Changes if it's in the realtime publication, so fixing those findings closes both. It doesn't connect to Realtime, join channels, or see your realtime.messages policies or the "Allow public access" setting, so run the checks above for that. The free Supabase RLS policy checker (runs in your browser) checks your public tables' policies for RLS off, using (true) and open writes; it skips the realtime schema.
FAQ
Does Supabase Realtime respect RLS?
For Postgres Changes, yes: Supabase's Realtime Authorization docs say database records are sent only to clients allowed to read them under your RLS policies. That cuts both ways. If a table has a select policy like using (true) for anon, anyone with your public key can subscribe and watch every new row arrive live. Broadcast and Presence are different: they're controlled by policies on realtime.messages, and only on private channels.
Are Supabase Broadcast channels private by default?
No. A channel is only checked against realtime.messages policies when the client joins it with config: { private: true }. Supabase's docs also say that to enforce private channels you need to turn off the 'Allow public access' setting in Realtime Settings, otherwise clients can still join public channels.
Is the filter option in postgres_changes a security control?
No. The filter (for example user_id=eq.123) is chosen by the client code, so anyone can remove it or change the value in their own browser. It reduces noise. Your RLS select policy is what decides which rows a subscriber can receive.
I removed a user from a room but they still get messages. Why?
Realtime caches a client's access for the life of the connection. Per Supabase's docs, policies are re-checked when the client subscribes or sends a new JWT, so a revoked user keeps receiving until their token expires or refreshes. Keep the JWT expiry short and disconnect clients when you revoke access.
Why does my migration fail with 'must be owner of table messages'?
Because RLS is already enabled on realtime.messages and you don't own that table. Supabase's docs say to remove the alter table realtime.messages enable row level security line; creating policies on realtime.messages is allowed. The failed alter aborts the transaction, so policies after it never get created.
Does Abbi Labs check Realtime?
Not directly. The free outside scan reports tables your public key can read, which are the same rows anyone could stream through Postgres Changes if that table is in the supabase_realtime publication. It doesn't connect to Realtime, join channels or see your realtime.messages policies, and the free policy checker skips the realtime schema. Use the queries and the signed-out test on this page for that part.