cd /news/ai-tools/catching-column-level-privilege-esca… · home › topics › ai-tools › article
[ARTICLE · art-178002] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

Catching Column-Level Privilege Escalation, Non-Invoker Views, and Bundled Secrets in Supabase (v0.7.0)

A developer released supabase-rls-check v0.7.0, an MIT-licensed Python tool with 159 passing tests that detects column-level privilege escalation in Supabase apps, where table-level UPDATE grants let authenticated users modify sensitive columns like role, is_admin, and credits despite row-level ownership policies. The release adds offline detection of this pattern and non-invoker views in raw SQL migration files, plus a new scan-bundle command and MCP server support for scanning compiled frontend bundles for leaked keys.

key takeaway

Table-level UPDATE grants on Supabase tables let any authenticated user PATCH sensitive columns like role or credits even under row-ownership RLS policies; revoke table UPDATE and grant column-level UPDATE only on safe fields such as display_name and avatar_url.

by read3 min views2 publishedNov 29, 2026

The most common Row Level Security bug I see in AI-generated Supabase apps (Lovable, Bolt, v0, Cursor) passes every basic "is RLS enabled?" check.

The developer enables RLS on public.profiles and adds an ownership policy for updates:

CREATE POLICY "users_update_own_profile" ON public.profiles
  FOR UPDATE TO authenticated
  USING ((SELECT auth.uid()) = user_id);

Later, they add billing or role columns to public.profiles: role, is_admin, plan, credits, or balance. Because PostgreSQL grants table-level UPDATE to authenticated by default on new Supabase tables, and USING ((SELECT auth.uid()) = user_id) only restricts which row is targeted, any signed-in user can open DevTools and run:

PATCH /rest/v1/profiles?user_id=eq.<their-uid>
Content-Type: application/json

{"role": "admin", "is_admin": true, "credits": 999999}

PostgREST updates the columns directly.

I released supabase-rls-check v0.7.0 (MIT, Python 3.11+, 159 automated tests passing) to catch this pattern alongside non-invoker views and leaked keys inside compiled frontend bundles.

GitHub: https://github.com/Tthanh2k6/supabase-rls-check

PyPI: https://pypi.org/project/supabase-rls-check/

column_update_escalation (Catalog + Static SQL DDL) Rule #21 in check.sql (column_update_escalation, High severity) inspects pg_catalog.pg_policies and pg_catalog.pg_attribute in one read-only query. It flags any PERMISSIVE policy for UPDATE or ALL in public granted to anon, authenticated, or PUBLIC when:

role, is_admin, plan, tier, credits, balance, subscription_status, or org_id. UPDATE privileges on those columns (has_table_privilege or has_column_privilege). WITH CHECK expression does not reference and guard the column name. The basis field lists the exact updatable columns (for example, credits, is_admin, role).

To fix it without breaking profile edits, revoke table-level UPDATE and grant column-level UPDATE only on safe user-editable columns (or move billing and role state to a separate server-managed table):

REVOKE UPDATE ON public.profiles FROM PUBLIC, anon, authenticated;
GRANT UPDATE (display_name, avatar_url) ON public.profiles TO authenticated;

In v0.7.0, the static SQL parser (scan_sql) also detects column_update_escalation directly on raw migration .sql files before you apply them to a database, tracking CREATE TABLE, ALTER TABLE ... ADD COLUMN, REVOKE UPDATE, and column-specific GRANT UPDATE (col1, col2).

view_not_invoker Across Catalogs and Raw Migrations In PostgreSQL, CREATE VIEW public.user_summaries AS ... defaults to security_invoker = false. When queried through PostgREST (/rest/v1/user_summaries), the view executes with the permissions of the view owner (postgres), bypassing RLS on the underlying tables.

check.sql already checked live catalogs for views in public missing security_invoker=true in pg_class.reloptions. In v0.7.0, scan_sql brings the same view_not_invoker detection to offline .sql migration files and folders. It flags CREATE [OR REPLACE] VIEW statements in public unless the view is created with WITH (security_invoker = true) (or on / 1) or followed by:

ALTER VIEW public.user_summaries SET (security_invoker = true);

Materialized views are skipped by this check and covered separately under matview_api_exposed and auth_users_exposed.

scan-bundle) Earlier versions included scan-env for project source directories (which skips dist/, build/, and web-build/). When auditing a deployed or pre-release build artifact where source files are already bundled into dist/assets/index-a1b2c3.js or static .html files, you want to scan the compiled output directly.

v0.7.0 adds scan-bundle to both the CLI and the read-only stdio MCP server:

supabase-rls-check scan-bundle ./dist --out bundlescan.json

scan-bundle walks build output, source files (.js, .mjs, .cjs, .jsx, .ts, .tsx, .html, .htm, .vue, .svelte), .env*, app.json, and eas.json up to 5 MB per file with zero network calls. It detects:

service_role_in_client_code and public_env_service_role (Critical): JWTs whose payload decodes to "role": "service_role" (ignoring safe anon JWTs) and sb_secret_* keys.db_url_in_client_code (Critical): postgres:// or postgresql:// connection strings containing a literal password (ignoring placeholders such as ${DB_PASSWORD}). public_env_secret_key (High): client-prefixed variables (NEXT_PUBLIC_, VITE_, EXPO_PUBLIC_, REACT_APP_, PUBLIC_, NUXT_PUBLIC_) carrying secret prefixes ( sk_live_, rk_live_, sk-proj-, sk-ant-) or secret variable names. Every match is masked before printing (first6…last4) so secrets never leak into terminal logs or CI artifacts.

pipx install supabase-rls-check
uvx supabase-rls-check --version

To inspect the full explanation and remediation SQL for the new column escalation rule:

supabase-rls-check explain column_update_escalation
── more in #ai-tools 4 stories · sorted by recency
── more on @supabase-rls-check 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/catching-column-leve…] indexed:0 read:3min 2026-11-29 · —