How to Configure GitHub Copilot Supabase Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up github copilot supabase read only access, create a dedicated Postgres role with select rights. Then, give that user string to the agent tool instead of the default admin password. Many teams skip this step and hand the default Postgres password to their coding assistant. When a role is too broad, an agent can run bad queries that change or drop tables. How to set up github copilot supabase read only access Every new Supabase 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.

To set up github copilot supabase read only access, create a dedicated Postgres role with select rights. Then, give that user string to the agent tool instead of the default admin password. Many teams skip this step and hand the default Postgres password to their coding assistant. When a role is too broad, an agent can run bad queries that change or drop tables.

How to set up github copilot supabase read only access

Every new Supabase project comes with a default Postgres role that holds admin rights. Supabase does not grant full superuser rights because those allow destructive actions on the database. Still, the password you set at project creation belongs to that default admin role. Supabase warns teams never to share this main password with a third-party service. Instead, you should make a fresh database user for each tool or service you use.

To lock down an AI coding assistant, an admin first logs into the database. The admin creates a new database role made just for the assistant. Next, the admin grants usage rights on the target schema to this new role. After that, the admin grants select privileges on the tables the assistant needs to read. The admin also sets default privileges so future tables stay readable without manual updates.

Once the role is ready, the developer updates the local agent setup. Coding agents reach external databases through protocol servers or local shell commands. You put the new read-only user and password into the database string for the agent. Now the database engine will block any write, update, or delete commands from that user.

What native database roles solve and what they leave open

A read-only Postgres role solves the biggest risk of AI database use. It stops the coding assistant from changing rows, dropping tables, or altering your schema. If the agent makes a mistake and writes a delete statement, Postgres rejects it right away. This native role setup decides who can log in and which tables they can read.

Still, a static database role leaves several daily security gaps wide open on developer laptops. First, the developer still holds a raw database password in a plain text local file. Anyone or any script on that machine can read that file and reuse the key. Second, Postgres table permissions are all or nothing for the columns you allow.

If the agent reads a users table to check the schema, it pulls real rows. Those query results often include emails, phone numbers, card numbers, or national IDs. The raw data flows straight into the model prompt and leaves your local machine. A read-only role cannot rewrite matched fields in results before the agent sees them.

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.

Third, database roles do not inspect what individual statements do while they run in flight. An agent with select rights can still run a massive join across millions of rows. That bad query can lock up CPU and slow down the database for real users. Finally, every developer often shares the same read-only role, which ruins your audit logs. When a slow or strange query runs, you only see the shared role name.

Why local agent approvals are not enough for data safety

Many coding editors let you turn on manual approval before an agent runs a command. This check asks the developer to click approve before a shell tool or query runs. While this helps catch obvious mistakes, humans get tired and click approve out of habit. Also, a developer looking at a safe select query cannot see the rows it will return.

The query looks harmless on the screen, so the developer approves it right away. One second later, the database returns hundreds of customer emails and phone numbers to the agent. True data safety requires checks on both the query and the data that comes back.

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

Should I give my coding agent the default Supabase Postgres password?

No, the default Postgres role has admin privileges across your project. Supabase advises teams to create a separate database user for every external tool or service.

Does a read-only Postgres role hide customer PII from the AI model?

No, a read-only role only blocks write and delete actions on the database. Any select query on a permitted table still returns full emails, phone numbers, and card numbers.

Can the built-in Supabase service role key restrict an agent to read-only queries?

No, the built-in service role key bypasses Row Level Security and allows full data changes. You must create a custom Postgres role with select grants to enforce read-only rules.

The query runs. The emails stay hidden.