How to Configure Codex Supabase Read Only Access
You set up codex supabase read only access by creating a restricted database user. Then you pass that user connection string to the coding agent environment. Many teams start by handing the default admin password to their AI tools. That shortcut gives the agent full power to change or delete tables. When an AI tool runs with broad database rights, one bad prompt can break production. How to set up codex supabase read only access Every project comes with a default postgres role that holds admi
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 codex supabase read only access by creating a restricted database user. Then you pass that user connection string to the coding agent environment. Many teams start by handing the default admin password to their AI tools. That shortcut gives the agent full power to change or delete tables. When an AI tool runs with broad database rights, one bad prompt can break production.
How to set up codex supabase read only access
Every project comes with a default postgres role that holds admin privileges. The platform does not grant full superuser status because that allows destructive actions. The password you create at project setup belongs to this admin role. Docs states you should never share this password with an external service. Instead, you should create a new database user for each tool you use.
To lock down your agent, you first log in as the admin role. You create a dedicated role for your AI assistant with login rights. Next, you grant usage on your target schemas to this new role. You then grant select rights on the existing tables in those schemas. You also set default privileges so future tables stay readable by this user. Finally, you give this new connection string to the agent tool environment.
Why a read-only database user is not enough
A restricted database role stops the AI agent from running write or delete statements. It solves the basic problem of accidental table drops or bad data updates. Still, database roles only check who logs in and which tables they can read. They do not inspect what individual queries do while they run in flight.
A read-only user with select rights on a customer table reads every column by default. When the agent queries that table, the database returns raw emails and phone numbers. Card numbers and national IDs also flow straight into the model context window. Also, a static connection string sits on developer machines or in agent settings. If that password leaks, anyone can read your entire database from anywhere.
Auditor Read-Only Access + Customer Support Access to Production: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Managing sensitive data and query audit trails
Native database roles apply the same static rules to every query in a session. You can restrict columns at the role level, but that often breaks join queries. Teams end up granting broad select rights so the coding agent can inspect schemas. Once you grant table read rights, the database sends back every row requested by default.
Standard logs also struggle to tie database queries back to a specific person. Because the agent uses one shared database user, every query looks identical in logs. You cannot tell which engineer prompted the agent to pull a sensitive table. Teams need a way to mask sensitive fields in query results and track users.
Check every Postgres query on the wire
Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres, inline in the Postgres wire protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.
Before a query runs, hoop.dev guardrails refuse bad deletes or drops with a real Postgres error, or hold risky queries for approval. On the way back, hoop.dev data masking rewrites sensitive values in returned rows in memory, and every verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.
Frequently asked questions
Should I give the 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 select rights for external tools.
Does a read-only role hide emails or card numbers from the agent?
No, table select grants return all rows and columns to the client by default. You need field masking to rewrite emails, phone numbers, and card numbers in results.
How do built-in API roles differ from a custom read-only database user?
The platform includes built-in roles like anon and authenticated for app API requests. For direct database connections from an agent, a custom role with select grants fits best.
Related guides
In this post