Secures Supabase Realtime private channels via RLS policies on the realtime.messages table.
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
supabase-mcp-verification tile MUST be installed and passing (provides MCP-based schema verification tooling).tenant-isolation-rls tile MUST be installed to provide tenant scoping patterns (supplies the JWT claim conventions and RLS helper functions referenced in Phase 2).{resource}:{tenant_id}:{sub_topic}.ALTER TABLE realtime.messages ENABLE ROW LEVEL SECURITY.CREATE POLICY "tenant_realtime_access" ON realtime.messages
FOR SELECT TO authenticated
USING (
extension ->> 'tenant_id' = (SELECT auth.jwt() ->> 'tenant_id')
);CREATE POLICY "tenant_realtime_insert" ON realtime.messages
FOR INSERT TO authenticated
WITH CHECK (
extension ->> 'tenant_id' = (SELECT auth.jwt() ->> 'tenant_id')
);realtime.messages.private in the client subscription config:
const channel = supabase.channel(`orders:${tenantId}:updates`, {
config: { private: true },
});
channel.subscribe((status) => {
if (status === 'SUBSCRIBED') console.log('Connected to private channel');
});public access level for channels carrying tenant-specific data.tenant_id in Presence track payloads:
channel.track({ tenant_id: tenantId, user_id: userId, online_at: new Date().toISOString() });channel.send({
type: 'broadcast',
event: 'order_updated',
payload: { tenant_id: tenantId, order_id: orderId, status: 'shipped' },
});extension->>'tenant_id' matches their JWT claim.supabase db push or apply_migration.realtime.messages via pg_tables query.pg_policies.