How to Configure Goose Supabase Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a goose supabase prevent delete workflow, create a dedicated database role without delete rights. Then, have the AI agent log in with that restricted user instead of the default admin role. Engineering teams often use the default project password when they first test local AI agents. That shortcut gives the agent broad rights across every table in the database. If the agent makes a mistake during a task, it can wipe out production rows in seconds. How a goose supabase prevent delete

End-to-End Encryption: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

To set up a goose supabase prevent delete workflow, create a dedicated database role without delete rights. Then, have the AI agent log in with that restricted user instead of the default admin role. Engineering teams often use the default project password when they first test local AI agents. That shortcut gives the agent broad rights across every table in the database. If the agent makes a mistake during a task, it can wipe out production rows in seconds.

How a goose supabase prevent delete setup works

Every new project starts with a default postgres role that holds admin privileges. The platform does not grant full superuser status because that allows destructive steps on the database. Even so, the default postgres role still has extra privileges for most admin tasks. You create the password for this admin role when you first start the project. The vendor docs say you should never give this password to an outside service unless you trust it completely. Instead, the docs recommend making a brand new user for every single service or tool.

To keep your data safe, you make a custom role just for your AI agent. You grant this new role permission to read tables, insert new rows, and update existing records. You leave out the permission to remove rows or drop tables. Next, you put the login details for this custom role into the local environment of the agent. When the agent runs a task, the database checks the role permissions before any query runs. If the agent tries to remove a row, the database engine blocks the command right away.

Native role limits and operational gaps

A custom database role solves the problem of all-or-nothing admin access. It stops an agent from running destructive commands across the whole schema when it only needs basic read and write access. It also separates agent traffic from human dashboard queries, which always run under the default admin role.

Still, static database roles only check who logs in at the start of a session. They do not inspect what individual statements or commands try to do in flight. For example, an agent might need delete rights on a temporary staging table to clean up test data. If you grant delete rights on that table, the role stays active for every session. Static grants also cannot tell a safe single-row update apart from a bad query that blanks out a whole column. Also, native roles require you to store static passwords on every machine where the agent runs. Maintaining separate roles and row rules for every new table takes constant manual work from your team.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Why query-level controls matter for AI agents

AI agents build and run queries on the fly based on user prompts. Because their actions change from task to task, fixed database roles often prove too rigid or too loose. If a role is too strict, the agent fails to finish valid cleanup work. If a role is too broad, a bad prompt can cause data loss through bulk updates or drops.

Teams also need to protect sensitive fields during normal read queries. Even when an agent cannot delete rows, a basic select query can pull private customer data into the model context. Data masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in query results. Combining command blocking with field masking gives teams fine control over every single query the agent sends.

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 is an open-source proxy that sits beside Postgres, RDS, or Aurora as a sidecar for your Postgres. Clients and agent tools keep their credentials and point their connection string at the listener.

On each query, hoop.dev guardrails refuse disallowed drops, deletes, or table reads before they run. Next, hoop.dev data masking rewrites sensitive fields in returned rows that match your rules. 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 AI agent the default postgres role password?

No, you should never share the default postgres password with an outside tool or agent. That role holds admin privileges, so you should create a separate user with limited rights for each service.

How does the database stop an agent from deleting rows?

You create a dedicated database role for the agent and only grant select, insert, and update privileges. When the agent sends a delete command, the database rejects the statement before it changes any data.

Why are static database roles not enough for AI agent safety?

Static roles only control who logs in and which general command types they can run. They cannot block risky bulk updates in flight, require human approval for one-off deletes, or rewrite emails and card numbers in query results.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.