All guidesDeep-dive articles

Supabase RLS

Why can Supabase users change their own role?

By Ohad Krispin, founder of VibeRaven · LinkedIn

Short answer

An owner-only RLS policy controls which rows a user can update. A table-wide UPDATE grant lets that user change any column on those rows, so grant UPDATE only on fields users may edit.

On this page

Why can a Supabase RLS user update their own role?

An ownership policy using auth.uid() = id keeps the edit on the caller’s row. If authenticated also has table-wide UPDATE, both checks permit changes to server-managed fields on that row. Keep the ownership policy and narrow the effective grant.

How do I set column-level grants for authenticated in Supabase?

For a profiles table where users edit display_name and avatar_url, put the revokes and grant below in one migration. Substitute your table and actual editable and protected columns.

Check for additional grants through roles that authenticated or anon inherit and remove any grants that still allow updates to protected columns. Confirm service_role keeps the grants it needs for server writes.

SQL
revoke update on table public.profiles from public, anon, authenticated;
revoke update (role, subscription_tier, is_admin) on table public.profiles
  from public, anon, authenticated;
grant update (display_name, avatar_url) on table public.profiles to authenticated;

How do I prevent users changing subscription_tier in Supabase?

Keep subscription_tier out of the editable column grant and write it from trusted server code using service_role. For profiles users can create, give INSERT its own allowlist or create the row on the server with trusted defaults. Review upserts and any exposed RPC functions that can write the protected fields.

How do I connect Claude Code, Cursor or Codex to the hosted MCP?

Run the matching command for Claude Code or Codex. In Cursor, add a Streamable HTTP MCP server named viberaven and paste the URL on the last line.

Terminal
claude mcp add --scope project --transport http viberaven "https://viberaven.dev/mcp?src=site"
codex mcp add viberaven --url "https://viberaven.dev/mcp?src=site"
https://viberaven.dev/mcp?src=site

How do I verify the Supabase column grant fix?

  1. 1
    Run this from your project folder to check the migrations for supported server-managed column findings in a local Postgres model.
    Terminal
    npx viberaven check
  2. 2
    The proof-gated fixer is in development. In a CLI build that includes it, run this from your project folder. It offers a migration only after your migrations and the candidate fix load in in-memory Postgres and the proof confirms that the protected write is denied, normal profile edits still work and service_role can still write the protected field.
    Terminal
    npx viberaven check --fix
  3. 3
    Review the migration and verify the effective grants and permitted writes on your Supabase staging database. The in-memory proof covers the migrations and writes it exercised.

Official docs behind this checklist

FAQ for builders before launch