How to Configure Codex Supabase Permissions

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up codex supabase permissions, make a read-only database user for your agent. Never give the default admin password to an AI coding tool. Many teams start by pasting their main database password into the agent workspace. That approach gives the AI agent full admin rights over every table. A bad prompt or agent mistake can then alter schemas or delete rows. Setting up a dedicated database role stops the agent from making unwanted changes. How codex supabase permissions work in your proje

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.

To set up codex supabase permissions, make a read-only database user for your agent. Never give the default admin password to an AI coding tool. Many teams start by pasting their main database password into the agent workspace. That approach gives the AI agent full admin rights over every table. A bad prompt or agent mistake can then alter schemas or delete rows. Setting up a dedicated database role stops the agent from making unwanted changes.

How codex supabase permissions work in your project

Every new project starts with a default postgres role. This default role has admin privileges across the database. The platform does not grant full superuser rights because those allow destructive actions. Even so, the default postgres role still holds extra rights for admin tasks. The password you create at project setup belongs to this admin role. Queries you run in the web dashboard also run as this default user.

The platform docs say you should never share this main password with outside tools. Instead, you should make a fresh database user for every outside service. When an AI coding agent connects to your database, it acts as a service. You can create a custom role that only has permission to read specific tables. Each project also comes with built-in roles like anon, authenticated, and service_role. Those built-in roles serve app traffic and API requests, not direct coding agents. A custom read-only role keeps your AI agent inside safe boundaries.

What native roles solve and what they leave open

Native database roles control who can log in and which tables they can read. A read-only user stops an AI coding agent from dropping tables or changing rows. This setup blocks destructive write commands before they can hurt your data. It also keeps your main admin password out of local config files.

Still, static database roles only check permissions at the table or column level. Once the agent logs in, it can run any read query on allowed tables. A broad select statement can pull thousands of customer emails or phone numbers. Native roles cannot rewrite sensitive fields like card numbers or national IDs in results. They also cannot pause a risky query to ask a human for approval. Static credentials sit on developer laptops and stay valid until someone rotates them. Teams need controls that inspect each query in flight and mask sensitive fields.

AI Agent Permissions + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Best practices for scoping agent database roles

Start by creating a separate database role just for your AI coding tool. Grant read access only to the specific tables the agent needs to see. Leave out tables that hold secrets, billing records, or private user profiles. Check your database logs often to see what queries the agent runs. Dashboard queries carry a special comment, which helps you separate human and agent actions. Rotate the password for this custom role on a regular schedule. If an agent only needs schema info, do not grant access to row data.

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

Should I give my default postgres password to an AI coding agent?

No, the default postgres role has admin privileges across your entire project. You should create a separate database user with limited rights for each tool.

Does the default database role have full superuser rights?

No, the platform withholds superuser rights to block destructive system actions. It grants the default postgres role admin privileges and selected extra rights instead.

Can a read-only database role stop an agent from reading sensitive fields?

A read-only role blocks writes, but it still returns all data from allowed tables. To rewrite emails or card numbers in results, you need query data masking.

The query runs. The emails stay hidden.