How to Configure Goose Supabase Least Privilege
To set up goose supabase least privilege, create a dedicated Postgres user for the agent. Then grant that role only the specific table permissions your task needs. Many teams start by giving their AI agent the default database password. That shortcut grants broad admin rights to an automated tool. If the agent makes a mistake, it can drop tables or read private records. How goose supabase least privilege works in Postgres Every Supabase project starts with a default postgres role. This role h
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 goose supabase least privilege, create a dedicated Postgres user for the agent. Then grant that role only the specific table permissions your task needs. Many teams start by giving their AI agent the default database password. That shortcut grants broad admin rights to an automated tool. If the agent makes a mistake, it can drop tables or read private records.
How goose supabase least privilege works in Postgres
Every Supabase project starts with a default postgres role. This role has admin privileges across your database. Supabase does not grant full superuser rights because those allow destructive actions. Even so, the default postgres role has extra rights for many admin tasks. When you set a database password at project creation, it controls this admin role. You should never give this password to a third-party service or AI agent. Instead, Supabase recommends that you make a new user for every external service.
Supabase also includes built-in roles like anon, logged in, and service_role. These roles support client apps and backend APIs, not interactive developer agents. When Goose connects to your database, it runs queries on your behalf. A proper goose supabase least privilege setup starts with a fresh Postgres role. You grant this role read rights only on the schemas it needs to inspect. If Goose must run migrations or fix data, grant write rights on those specific tables. Leave all other tables and system schemas off limits.
What native database roles solve and what they miss
Creating a dedicated Postgres role stops Goose from touching unrelated schemas. It also keeps your main postgres password out of local config files. If a credential leaks, the attacker only gets the limited rights of that role. This setup is a strong first step for any team using AI agents.
Still, static database roles only check who logs in at the start. They do not inspect what individual statements do while the session is active. If a role has write rights on a table, it can update permitted row (unless row-level security applies). A bad prompt could cause Goose to delete records inside an allowed table. Also, if a role can read a customer table, it pulls permitted column (unless row-level security applies). Static grants do not hide sensitive strings inside an allowed query result. Data masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in results.
Least Privilege Principle + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
How to scope agent sessions for daily work
Start by listing the exact tasks you want Goose to perform. Most debugging tasks only need read rights on a few app tables. Create a read-only role for these daily checks and use it by default. Never use the dashboard query editor credentials for an automated agent. Queries run in the dashboard execute as the admin postgres role.
When Goose needs to alter tables or update rows, treat that as an exception. Do not leave write rights active on the agent role all day. Instead, require a quick human check before any write query runs. You should also log every statement the agent sends to the database. Clear logs help your team see which prompts caused which database changes. Combining scoped Postgres roles with statement checks keeps your data safe during agent runs.
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. It runs beside your database and reads the Postgres wire protocol. 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 check the statement by its effect, table, or pattern. They refuse bad deletes or drops with a real Postgres error. On the way back, hoop.dev data masking rewrites sensitive values in returned rows based on your rules. Every query and 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 Goose the default Supabase postgres password?
No, the project password belongs to the default postgres admin role. Supabase advises making a separate database user for every external tool or service.
Is the Supabase postgres role a full Postgres superuser?
No, Supabase does not give out superuser rights because they allow destructive actions. The default postgres role is an admin role with extra privileges for select tasks.
How do I protect sensitive columns when Goose reads a table?
Standard table grants allow reading permitted rows (unless row-level security applies) and columns in that table. Use a proxy layer that rewrites emails, phone numbers, and card numbers in query results.
Related guides
In this post