Urgent.News

What's breaking now, across hundreds of outlets.

Tech

A catalogue-only Postgres role for nightly RLS drift checks (measured on PG17)

A monitoring job that reads pg_catalog does not need to read a single application row. I wanted to verify that claim instead of repeating it, so I ran a small local experiment. The setup Local PostgreSQL 17 container, one table public.orders , and a role created with: CREATE ROLE rls_monitor LOGIN PASSWORD 'CHANGE_ME' NOSUPERUSER NOCREATEDB NOCREATEROLE NOREPLICATION NOBYPASSRLS ; GRANT CONNECT…

Monitoring a Postgres database for Row Level Security (RLS) drift is possible without granting excessive privileges to a monitoring role. This was demonstrated using a small Local PostgreSQL 17 container with a single table named public.orders. The monitoring role, rls_monitor, was created with minimal privileges: LOGIN, NOSUPERUSER, NOCREATEDB, NOCREATEROLE, NOREPLICATION, NOBYPASSRLS, CONNECT, USAGE, and no select grants on tables.

The monitoring job utilized the 12-check SQL to assess RLS configurations. The checks included: verifying that RLS was disabled, checking if RLS was enabled but not forced, examining for permissive USING (true) SELECT/ALL policies, identifying missing WITH CHECK clauses, detecting policies open to PUBLIC, checking for SECURITY DEFINER without pinned search_path or bypassing roles, reviewing write grants to anonymous or authenticated users, inspecting public EXECUTE grants, monitoring future grants to pg_default_acl, and identifying views without the security_invoker.

The monitoring role was able to access the pg_catalog and information_schema, which provided the necessary catalog data for the checks. However, the role could not perform any data reads on the public.orders table, ensuring that sensitive customer data remained protected. The workflow, standalone SQL, a short guide, and the role template were made available for free at https://kurtoglu1.gumroad.com/l/supabase-rls-drift-monitor-free.

The author emphasizes that a catalog signal is not proof of a leak, and zero findings do not guarantee safety. Additionally, the nightly diff must be fail-closed to avoid false reporting in the event of credential issues.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Show DEV / Discuss: Testing an offline-first Android voice-memo UX where ideas sink and resurface months later

I'm building The Iceberg — an offline-only Android scratchpad for unfinished song ideas, voice hums, and lyric scraps — and I'd appreciate blunt UX and technical feedback from builders before…

  • The Iceberg is an offline Android app for capturing unfinished song ideas and voice memos.
  • Notes drift out of view over time, surfacing months later for inspiration.
  • App offers local ZIP export, no account, cloud storage, or ads required.

Introducing RepoLens: Looking Beyond the Code 🔍

A small project, a lot of learning, and my first public release. I've always been interested in building tools that solve practical problems for developers.

  • RepoLens analyzes code repositories to assess code quality metrics
  • Creator Aditya Tyagi aimed to evaluate aspects beyond just functional code
  • Metrics include comment density, long line analysis, and README quality

More from Saturday, 28 November 2026 →