How to Configure Goose Neon Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a goose neon prevent delete workflow, restrict your database roles first. You must also enable branch protection inside your cloud database project. Teams often connect AI agents to Postgres using a default owner account. That default role carries full rights to drop tables and erase rows. When an AI coding agent runs a bad query, it can wipe out data. Giving the agent a restricted Postgres role stops most accidental data loss. How to set up a goose neon prevent delete role Neon run

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 a goose neon prevent delete workflow, restrict your database roles first. You must also enable branch protection inside your cloud database project. Teams often connect AI agents to Postgres using a default owner account. That default role carries full rights to drop tables and erase rows. When an AI coding agent runs a bad query, it can wipe out data. Giving the agent a restricted Postgres role stops most accidental data loss.

How to set up a goose neon prevent delete role

Neon runs on standard Postgres, so you manage query rights through database roles. First, create a dedicated Postgres role just for your AI agent sessions. Do not use the default database owner key that comes with a new branch. Next, grant this new role permission to read tables and insert new rows. You can also allow update statements if the agent needs to fix records. Leave out the delete and truncate permissions on all important tables. Also block the role from dropping tables or changing the database schema. At the cloud control plane level, turn on protected branches for production data. Protected branches stop users and tools from deleting the entire database branch via API. Once you finish this setup, give the new role credentials to your local agent. The agent can now inspect schemas and add records without erasing existing rows.

What native database roles solve and what they miss

Database roles and branch rules stop many basic accidents before they happen. If the agent tries to run a delete command, Postgres blocks the query right away. Branch rules also keep your main database safe from accidental cloud API calls. Still, static Postgres roles only check who logs in and which table they touch. They cannot check the context or size of a query while it runs. For example, an agent with update rights can still set every column to null. That bad update ruins your data just like a delete statement would. Static roles also treat every query on a table the same way. You cannot let an agent delete one test row while blocking a full table wipe. Also, standard role permissions do not hide sensitive data in query results. If a table holds emails, phone numbers, or card numbers, the agent reads them all. Teams also struggle to manage dozens of custom Postgres roles across many database branches. Every time a schema changes, someone must update the grants for the agent role.

Why statement checks and data masking matter for AI agents

Safe AI database workflows need controls that look at each SQL command in flight. Instead of relying only on broad table grants, teams inspect the actual query text. This approach lets you block risky patterns like updates without a where clause. You can also pause specific delete statements and ask a human to approve them first. At the same time, data masking rewrites matched fields like national IDs in results. The agent gets the schema structure it needs without pulling raw personal records into prompts. Combining Postgres roles with statement checks gives your team a much safer workflow.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

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

Can a Neon protected branch stop SQL delete statements?

No, branch protection only stops someone from deleting the whole branch in the cloud console. To block SQL delete commands inside a table, you must revoke Postgres delete permissions.

Why not give the AI agent a read-only database role?

A read-only role works well when the agent only inspects data or writes code. If the agent must insert test rows or run migrations, it needs write access.

Can an update permission still cause data loss in Postgres?

Yes, an agent with update rights can overwrite existing values with blank or wrong data. Without a where clause check, one bad update statement can ruin an entire table.

The query runs. The emails stay hidden.