How to Configure Goose CockroachDB Prevent Delete
To set up a goose cockroachdb prevent delete rule, assign a custom database role. This role must grant read and insert rights while leaving out delete rights. Many teams connect the Goose AI agent to CockroachDB using an admin account. This shortcut helps developers move fast during early tests. Still, broad permissions let an autonomous agent remove rows or drop tables by mistake. A small prompt error can wipe out critical business records in seconds. How a goose cockroachdb prevent delete se
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 cockroachdb prevent delete rule, assign a custom database role. This role must grant read and insert rights while leaving out delete rights. Many teams connect the Goose AI agent to CockroachDB using an admin account. This shortcut helps developers move fast during early tests. Still, broad permissions let an autonomous agent remove rows or drop tables by mistake. A small prompt error can wipe out critical business records in seconds.
How a goose cockroachdb prevent delete setup works
CockroachDB uses role-based rules to control what users and apps can do. You start by creating a dedicated role just for the Goose agent. Next, you grant this role select, insert, and update permissions on target tables. You leave out the delete and drop permissions on purpose. Then you create a database user for Goose and assign the new role.
Goose connects to the database through a standard Postgres wire protocol driver. When you start a session, Goose logs in with those limited credentials. If the agent tries to run a delete statement, CockroachDB blocks the action. The database checks the role table and returns a permission denied error. Your rows stay safe even when the agent plans a bad step.
Where native database roles fall short
Native roles work well when an agent always needs the exact same rights. They decide who can log in and which tables they can touch. Yet real engineering tasks often need more flexible rules during a live session. For example, an agent might need to update one row but not the whole table. Native database roles cannot inspect the filter clause of an incoming query.
A role with update rights can still overwrite every row in a table by default. Setting every column to null does the same damage as a delete command. Also, managing dozens of tiny roles across many clusters takes a lot of time. Teams end up sharing credentials on local machines to get work done. Also, native roles do not mask sensitive data in query results. If a table holds emails, phone numbers, or card numbers, the query returns them raw.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Best practices for safe AI agent queries
Keep agent credentials separate from human developer accounts at all times. Give each automation tool its own identity so you can track its actions. Turn on database audit logs to see which queries fail permission checks. Failed delete attempts often show that a prompt or workflow needs fixing.
Test your agent workflows against a staging database before touching production data. Check that the agent handles permission errors without getting stuck in a retry loop. Finally, pair static database roles with statement-level checks and data masking for sensitive fields. Rewriting matched emails or national IDs in results keeps private data out of prompts.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Can Goose delete data if it only has read and write roles?
Yes, standard write roles in CockroachDB usually include the delete privilege by default. You must create a custom role that grants insert and update without delete.
Does blocking delete commands stop all data loss from AI agents?
No, an agent with update rights can still overwrite existing data with blank values. You also need controls that check queries before they change many rows at once.
How should teams handle sensitive fields when Goose reads CockroachDB?
Database roles only allow or block access to whole tables or columns. Use dynamic data masking to rewrite emails, phone numbers, and card numbers in query results.
Related guides
In this post