How to Configure Supabase Read Only User

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a supabase read only user by creating a custom database role. Then you grant that role select rights on your target schemas and tables. Many teams skip this step and share the default admin login instead. Every new project starts with a default postgres role that holds admin privileges. The platform does not grant full superuser rights to prevent destructive actions. Yet the password you set at project creation belongs to this postgres admin role. Sharing that password with outside to

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up a supabase read only user by creating a custom database role. Then you grant that role select rights on your target schemas and tables. Many teams skip this step and share the default admin login instead. Every new project starts with a default postgres role that holds admin privileges. The platform does not grant full superuser rights to prevent destructive actions. Yet the password you set at project creation belongs to this postgres admin role. Sharing that password with outside tools or team members gives them broad write power. One bad query can drop tables, change records, or wipe out production data.

How to set up a supabase read only user

The platform builds on standard Postgres role rules to manage database permissions. When you run queries in the project dashboard, they execute as the postgres role. Those dashboard queries also carry a comment tag showing their dashboard source. You can use this admin access to create a fresh database role for reading. The platform recommends making a separate user for every external service you connect. First, you create a new role with login rights and a strong password. Next, you grant usage on the target schema to that new role. Then you grant select rights on all existing tables inside that schema. You also alter default privileges so future tables allow select access for this role. The platform also includes built-in roles like anon for public API calls. A direct database user differs from those API roles because it connects straight to Postgres. Once you finish this setup, analytics tools and developers can log in with the new role. The database engine will block any attempt to insert, update, or delete rows.

What native read roles solve and what they miss

A native read role stops accidental writes and table drops during routine checks. It separates human reporting tasks and third-party apps from your main admin account. Still, database roles only check who logs in and which tables they can read. A read role cannot inspect what individual queries do while they run in flight. Once a user has select rights on a table, they can read every column by default. That means queries return sensitive fields like emails, phone numbers, card numbers, and national IDs. Masking rewrites matched fields in results, and native Postgres roles do not do that on the fly. Static roles also rely on long-lived passwords that people copy into local SQL clients. When five developers share one read-only login, your database logs show one role name. You cannot tell which person ran an expensive query that locked up memory. You also have to rotate passwords by hand when someone leaves the team.

Managing permissions across growing database schemas

Maintaining custom database roles takes ongoing effort as your data model grows. When engineers add a new schema, the read role has no access to it by default. Someone with admin rights must grant usage and select privileges on the new objects. If an engineer creates tables under a different role, default privilege rules might not fire. Teams often fix these permission errors by granting broader access than needed. Over time, temporary grants stack up and turn a strict role into a wide-open account. Reviewing table and column grants across dozens of schemas requires manual catalog checks. Even when permissions stay tight, a read user can still pull full table dumps. Native role rules do not cap how many rows a single select query returns.

Read-Only Root Filesystem + User Provisioning (SCIM): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Add query and result controls beside Postgres

Grants and pools govern who logs into PostgreSQL. Yet every query in an open session still runs with that role's full scope. In practice, hoop.dev sits inline in the wire protocol beside your database as a sidecar for your Postgres. For every plain or prepared query an agent or human runs against production, hoop.dev decides to pass, mask, block, or escalate it for review.

When a tool or agent sends SQL, hoop.dev Postgres controls block banned statements before execution or hold risky ones for human approval via an AI Analyzer you configure. Matched sensitive columns in result rows are masked in memory before they reach the caller. Each query and decision is logged per listener, which generates evidence for SOC 2, HIPAA, and GDPR audits. View the binary on GitHub.

Frequently asked questions

Is the default postgres role in Supabase a full superuser?

No, the default postgres role has admin privileges rather than full superuser rights. The platform blocks superuser access so users cannot run destructive system operations.

Should I share the main project password with reporting tools?

No, the password set at project creation belongs to the default postgres admin role. You should never give it to a third-party service unless you trust them completely. Create a dedicated user for every outside service instead.

Which role runs queries inside the Supabase dashboard?

Queries that you run inside the project dashboard execute under the default postgres role. The system attaches a source comment to those queries to mark that they came from the dashboard.

The query runs. The emails stay hidden.