Are Supabase Realtime channels private by default?
No. In Supabase, Allow public access to channels is on by default, and with it on no policy check runs: anyone holding your project's anon key can subscribe to and broadcast on any public channel. To lock a channel down, add RLS policies on realtime.messages, join with private: true, then turn the public access setting off.
Full fixes free for every critical issue (no critical? one other fix is free).
Home › Guides › Are Supabase Realtime channels private by default? · Last updated · By Ember, SniffPup
Public and private channels, in plain English
Supabase Realtime sends live messages (Broadcast), who is online (Presence) and database changes between your app and its users. A public channel checks nothing when someone joins. A private channel checks your Row Level Security policies on the realtime.messages table first. Your table RLS is a separate layer and does not cover Broadcast or Presence.
Why AI-built apps end up with public channels
Chat, cursors, notifications and live dashboards are quick to add, and the quickest version is a plain channel with no options. It works on the first try, so nothing prompts you to go back and add policies. Supabase's own default is public, so a generated app that never mentions private: true is using public channels.
How to make your channels private
1. List the channels your app opens
Search your code for .channel( and note each topic name and whether it sets config: { private: true }. Any channel without it is a public channel.
2. Write RLS policies on realtime.messages
Add a select policy for who may receive messages and an insert policy for who may send, using realtime.topic() to tie each user to the topics they belong to. Do not add ALTER TABLE realtime.messages ENABLE ROW LEVEL SECURITY: RLS is already on, and that line fails with 42501 must be owner of table messages and aborts the rest of the migration.
3. Join with private: true
In every client, create the channel with config: { private: true }. Private channels check your policies when the client joins.
4. Turn off Allow public access to channels
In Realtime Settings, switch Allow public access to channels off, after your clients send private: true. Clients that do not are then rejected with PrivateOnly. Supabase warns that saving settings disconnects every connected client, so pick a quiet moment.
5. Test with a user who should not get in
Subscribe from a second account that is not a member of the room. With a select policy in place it should receive nothing. Remember that once public access is off, clients with no matching policy connect but receive no messages, so a silent channel is not proof that your policy is right: also test that a member does receive messages.
6. Keep the JWT short-lived
Supabase caches a client's access for the life of its connection. If you remove someone from a room, they keep receiving messages until their JWT expires or a new one is sent. Keep the expiry window short.
Example policies (from the pattern in Supabase's docs)
This assumes a table public.rooms_users that lists which user may join which topic. Yours may be shaped differently, so adapt the check.
-- A room table and a membership table like the one in Supabase's docs
create policy "members can receive broadcast"
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')
)
);
create policy "members can send broadcast"
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')
)
);Client side, create the channel with supabase.channel('room-1', { config: { private: true } }).
Fix prompt (paste into your AI builder)
Review how this app uses Supabase Realtime. List every channel. For each one, create it with config: { private: true } and add RLS policies on realtime.messages (select to receive, insert to send) that check realtime.topic() against a table of the rooms the signed-in user belongs to. Do not run ALTER TABLE realtime.messages ENABLE ROW LEVEL SECURITY, because RLS is already on. Show me every channel and every policy you added.Where SniffPup fits, and where it does not
SniffPup's free scan looks at a live URL you own from the outside, passively. For a Supabase app it can test what a stranger can read from a table with your public key, read-only. It never joins a Realtime channel and cannot see your Realtime settings or policies, so the steps above are yours to check. See also RLS disabled on public tables. Only scan sites you own or are authorized to test.
Honest limits
A clean SniffPup report means we didn't find anything in the checks we run. It doesn't mean your app is secure. See what the scanner does and never does. Supabase can change these settings and defaults; check the docs below.
Sources (checked November 29, 2026)
- Supabase docs: Realtime Authorization
- Supabase docs: Realtime Settings (Allow public access to channels)
FAQ
Are Supabase Realtime channels private by default?
No. In Supabase's Realtime Settings, Allow public access to channels is Enabled by default. With it enabled, no policy check runs, and anyone holding your project's anon key can subscribe to and broadcast on any public channel. To make channels private, turn that setting off, add RLS policies on realtime.messages, and join with private: true.
My anon key is public. Is that a problem for Realtime?
The anon key is meant to sit in your frontend, so it cannot be what protects a channel. Supabase's docs say that with public access enabled, anyone holding it can join and broadcast on public channels. The protection has to come from RLS policies on realtime.messages and private channels.
I set private: true but my users receive no messages. Why?
Private channels check RLS policies on realtime.messages when a client joins. Supabase says that once Allow public access is off and there are no policies, clients connect but receive no messages. Add a select policy for receiving and an insert policy for sending, then test with a member and a non-member.
Why does my migration fail with 42501 must be owner of table messages?
Row Level Security is already enabled on realtime.messages, so ALTER TABLE realtime.messages ENABLE ROW LEVEL SECURITY fails, and that aborts the transaction and skips every statement after it, including your create policy lines. Remove the ALTER TABLE line. Supabase says managing policies on that table is allowed.
Do Postgres Changes need these policies too?
Postgres Changes follow the RLS on the table itself: Supabase says records are sent only to clients allowed to read them. Private and public channels can both subscribe to Postgres Changes, so keep RLS on your own tables as well.
Can SniffPup tell me if my Realtime channels are public?
No. SniffPup's free scan is passive and never joins a Realtime channel, reads your Realtime settings or reads your policies. It can test what a stranger can read from a Supabase table with your public key, read-only. For channels, check the setting and your code yourself. Only scan sites you own or are authorized to test.