How to Configure Aider Supabase Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up aider supabase read only access by making a dedicated Postgres role with select grants. Then you give that database role to your local coding agent instead of the default admin login. Many teams take a shortcut and share their main project password with local tools. Every Supabase project starts with a default postgres role that holds admin rights. If you give that password to an agent, a bad command can drop tables or alter rows. How to set up aider supabase read only access Aider

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 aider supabase read only access by making a dedicated Postgres role with select grants. Then you give that database role to your local coding agent instead of the default admin login. Many teams take a shortcut and share their main project password with local tools. Every Supabase project starts with a default postgres role that holds admin rights. If you give that password to an agent, a bad command can drop tables or alter rows.

How to set up aider supabase read only access

Aider runs in your terminal and can run shell commands or test scripts when you allow it. When the agent checks database schemas or tests queries, it uses the database login from your shell. Supabase advises that you should never give the main postgres password to an outside tool. Instead, Supabase suggests making a separate user for each service or tool you run.

To build this setup, you log in to your database as the admin role first. You create a new database role made just for your coding agent. Next, you grant connect rights on the database and usage rights on your target schemas. Finally, you grant select rights on the tables the agent needs to read. You also set default privileges so the role can read new tables made in the future.

Once the role is ready, you put its login details into your local shell variables. When the agent runs a database client or script, it logs in with this read-only role. If the agent tries to run an insert, update, or delete statement, Postgres blocks the change right away.

What native database roles solve and what they miss

Native Postgres roles do a great job of stopping accidental writes and schema drops. They make sure a coding agent cannot wipe out production tables or alter existing rows. Separating roles per tool also makes it easier to rotate passwords without breaking other apps.

Still, a read-only database role only checks who logs in and which tables they can read. It does not inspect what individual select statements do while they run in flight. A read-only query can still pull thousands of customer emails, phone numbers, or card numbers into terminal output. From there, sensitive data gets sent straight to the language model provider in the prompt context.

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.

Static roles also require you to store a database password in a local file on laptops. If a developer laptop is lost, that static password stays active until an admin revokes it. Database grants alone cannot rewrite sensitive fields in query results or remove static passwords from developer machines.

Why column grants and row rules are hard to maintain

PostgreSQL lets you restrict select rights down to specific columns on a table. You can also turn on row level security to limit which rows a given role can read. In theory, you can grant the agent role access to safe columns and skip sensitive ones.

In practice, column grants break many common schema inspection queries and migration tools. Coding agents often query whole tables with a wildcard to learn how an app works. If a table has restricted columns, a wildcard select fails with a permission error instead of returning safe columns. Teams also add new tables and columns every week during normal feature work. Keeping manual column grants in sync across dozens of tables takes constant effort from your team.

Run guardrails and masking on the Postgres connection

Role grants and firewall rules are needed setup. Setup alone cannot check single SQL statements or mask sensitive rows in a response. By design, hoop.dev sits inline in the Postgres protocol beside Postgres, RDS, or Aurora as a sidecar for your Postgres. On every production query from an engineer or AI agent, hoop.dev decides whether to pass, mask, block, or hold it for approval.

First, hoop.dev guardrails refuse disallowed drops or deletes before they run, and risky statements can pause for human review. Next, hoop.dev data masking rewrites sensitive fields in returned rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and logs every statement and verdict per resource. Check out the project on GitHub.

Frequently asked questions

Why should I not use the default postgres role with Aider?

The default postgres role in Supabase has admin rights across your project database. Using it lets an agent run destructive commands that can modify or delete your data. Supabase advises creating a separate database user for every outside tool you use.

Does a read-only role stop sensitive data from reaching the AI model?

No, a read-only role still has full select access to every column on granted tables by default. When the agent runs a query, raw emails, phone numbers, or card numbers return to the terminal. Those results then get sent to the model provider unless masking rewrites matched fields in results.

Can row level security limit what the read-only role reads?

Yes, Postgres applies row level security policies to custom roles unless they have bypass rights. You can write policies that restrict which rows the agent role can select. Still, row policies filter whole rows and do not mask specific fields inside a returned row.

The query runs. The emails stay hidden.