Overview
Row‑level security (RLS) is a foundational safeguard for Supabase projects, limiting data visibility to authorized roles. The open‑source tool supabase-rls-check provides a read‑only catalog query that scans PostgreSQL system catalogs for RLS misconfigurations. Version 0.6.3 expands the original functionality to cover three critical edge cases—extension‑owned tables in the public schema, React Native/Expo configuration files, and static Model Context Protocol (MCP) scanners—while keeping the tool lightweight and free of network calls.
Extension‑Owned Tables in the Public Schema
Supabase exposes the public schema to the anon and authenticated roles by default. The rule rls_disabled flags any table in this schema that lacks RLS. For ordinary tables, the recommended remediation is to enable RLS:
ALTER TABLE public.my_table ENABLE ROW LEVEL SECURITY;
When a developer adds an extension such as PostGIS to the public schema, the extension creates system tables like public.spatial_ref_sys owned by the bootstrap superuser supabase_admin. Attempting to enable RLS on these tables triggers a PostgreSQL error: ERROR: must be owner of table spatial_ref_sys. The 0.6.1 update added a join to pg_depend and pg_extension within check.sql to detect such extension‑owned tables. The tool now reports them with a basis of “owned by extension” and suggests moving the extension out of public rather than applying RLS, aligning remediation with Supabase discussion #52767.
React Native and Expo Configuration Scanners
The updated scan-env routine now inspects React Native and Expo source files—app.json, app.config.*, eas.json—alongside traditional agent configuration files. New rules include db_url_in_client_code, which flags hard‑coded database URLs, and logic that ignores placeholder passwords such as ${DB_PASSWORD}. The scanner also skips public keys that are intentionally omitted from client code, reducing false positives.
Static MCP Scanners
Support for MCP version 1.2 (or higher) has been added. The static scanner identifies tables that belong to “exposed” schemas—any schema other than public or graphql_public. It applies severity tiers based on schema type: internal Supabase schemas (e.g., auth, storage) are marked high severity, while custom schemas receive a medium warning. This rule is shared with other checks, ensuring consistent coverage across the project.
Using supabase-rls-check
The tool requires Python 3.11 or newer. It can be installed globally with pipx install supabase-rls-check or via uvx supabase-rls-check --help. Running the CLI against a local database snapshot generates a markdown report and writes findings to snapshot.json:
node src/cli.ts snapshot.json
node src/cli.ts snapshot.json --fail-on high
The --fail-on flag makes the command exit with a non‑zero status if any high‑severity issue is present, enabling integration into CI pipelines.
Continuous Integration Integration
Supabase provides a GitHub Action that runs a diff‑based end‑to‑end job against a postgres:15 service. The action executes scripts/e2e_diff.py to compare the current snapshot with the last commit. If new findings are introduced—such as a table newly exposed without RLS—the job fails when --fail-on-new is set to high, preventing accidental security regressions.
Remediation Tips
- Always enable RLS in migrations:
ALTER TABLE my_table ENABLE ROW LEVEL SECURITY; - For extension tables, move the extension into a dedicated schema or grant
SELECTto the appropriate role instead of relying on RLS. - Validate React Native and Expo configuration files to ensure database URLs are not embedded in client code.
- Use the MCP static scanner to confirm that custom schemas remain in the “exposed” list only when intentionally public.
Conclusion
Version 0.6.3 of supabase-rls-check delivers comprehensive coverage for three common but overlooked scenarios. By automatically flagging extension‑owned tables, scanning client‑side configuration files, and extending support to MCP, the tool offers developers a reliable, read‑only audit path that integrates smoothly into existing development workflows. Implementing these checks early in the migration or development cycle helps prevent the most frequent RLS misconfigurations and protects sensitive data from unauthorized access.

Leave a Reply