Realtime Postgres RLS now available on Supabase
Supabase Realtime now enforces PostgreSQL Row Level Security on change broadcasts. Previously every database change went to every client. A new in-database function, WALRUS, takes each logical replication record, finds active subscribers from a subscription table, assumes each subscriber's identity and checks visibility with a primary-key lookup. Prepared statements remove query planning cost, which is often 2-3x execution time for simple queries, and colocating the check in Postgres avoids network round trips. Per-record processing grows from about 11 ms with 1 subscriber to about 304 ms with 10,000. Recommendations: skip RLS on public tables, keep policies index-backed and join-free, and use small fixed-size primary keys.
Related posts
- Realtime: Broadcast from Database
Supabase mediumAdeptSupabase Realtime's Broadcast from Database sends database change events to clients through Postgres triggers that write to a `realtime.messages` table. Realtime reads that table via a replication slot on its WAL publication and broadcasts each new row to the target channel immediately. Compared with polling-based Postgres Changes it needs more setup (RLS policies, a trigger function using `realtime.broadcast_changes` or `realtime.send`, and private channels on the client). In return it can target specific operations, send only chosen columns, route messages to channels with SQL, and scale to tens of thousands of concurrent subscribers. `realtime.send` catches exceptions and reports errors via `pg_notify`, so a failed send does not break the trigger.
- Realtime or Pipelines? How to choose the right tool
Supabase mediumAdeptSupabase Realtime and Supabase Pipelines both read Postgres changes via logical replication but serve different jobs. Realtime pushes changes to client apps over WebSocket with best-effort delivery, temporary replication slots, and a per-subscriber RLS check for every change, typically under 100ms. Pipelines is managed CDC to analytical destinations like BigQuery, with persistent slots, at-least-once delivery, batching, and resume from retained WAL. The guidance: never use Realtime's Postgres Changes to maintain a durable copy of data in another system, because disconnects and restarts silently drop changes. Use Pipelines for that and Realtime for live user-facing updates, often both together.
- Supabase Realtime: Broadcast and Presence Authorization
Supabase mediumAdeptSupabase Realtime now supports authorization for Broadcast and Presence channels using Postgres Row Level Security policies on a managed `realtime.messages` table, where SELECT policies govern receiving and INSERT policies govern sending. Clients opt in with a `private: true` channel config, and policies can reference the channel name via `realtime.topic()` and the extension column. On subscription, the server loads JWT claims into a Postgres transaction with `set_config`, runs rolled-back SELECT/INSERT probes against the table, and caches the resulting per-socket policy map in memory. This adds latency only at connect time, and policies are re-checked on reconnect or token refresh, so token expiry controls how quickly policy changes take effect.
- Supabase Security Retro: 2025
Supabase easyNoviceSupabase's 2025 security work centered on safer defaults around Postgres Row Level Security and API exposure. Changes include RLS enabled by default for dashboard-created tables, event triggers to enforce RLS on tables created elsewhere, and alerts plus Splinter-based Security Advisors for misconfigurations. Long-lived JWT anon/service_role keys are being replaced by publishable and revocable secret keys, with asymmetric JWT signing and automatic revocation of keys leaked to GitHub. Legacy keys will be removed in late 2026, and pg_graphql will be disabled by default on new projects. The HackerOne VDP has resolved 139 reports with a median first response of 8 hours, and paid bounties are planned for 2026.
- Postgres Changes gets AND filters, new operators, and column selection
Supabase mediumAdeptSupabase Realtime's Postgres Changes subscriptions now support AND-composed filters across multiple columns, new operators (like, ilike, is, match/imatch for POSIX regex, isdistinct, and not. negation), a typed filter builder, and a select option that returns only chosen columns plus the primary key. Server-side filtering and trimmed payloads cut billable messages and egress, since each delivered change counts per subscriber. Column selection needs supabase-js 2.109.0+, RLS still applies, DELETE events can't be column-filtered because they carry only the primary key, and OR composition, JSON/array containment, full-text and range operators remain unsupported.