How to Configure Gemini CLI CockroachDB Prevent Delete
You set up a gemini cli cockroachdb prevent delete rule by limiting database roles. You also require manual approval before the AI agent runs any shell commands. Many teams start by giving the local AI tool a standard developer login. That broad role often lets the agent drop tables or remove rows by mistake. A small prompt error can turn a routine check into a major outage. Limiting what the database user can do stops these bad writes early. How to set up a gemini cli cockroachdb prevent dele
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.
You set up a gemini cli cockroachdb prevent delete rule by limiting database roles. You also require manual approval before the AI agent runs any shell commands. Many teams start by giving the local AI tool a standard developer login. That broad role often lets the agent drop tables or remove rows by mistake. A small prompt error can turn a routine check into a major outage. Limiting what the database user can do stops these bad writes early.
How to set up a gemini cli cockroachdb prevent delete workflow
First, you need to create a dedicated database role for the AI tool. In your database cluster, roles control which SQL actions a user can run. You grant this new role permission to read tables and insert new rows. You leave out permission to remove rows or drop tables on key data. Next, you create a separate database user and assign it to this role.
The terminal agent runs local commands and reads your local shell variables. When the agent needs to query the database, it uses the local client. You give the local client the login details for the limited database user. Now the database engine checks every query that comes from the terminal agent. If the agent tries to remove rows, the database rejects the statement right away. You should also keep the terminal agent in its manual confirmation mode. This step makes a human review each shell command before it runs.
What native roles solve and what they leave open
Native database roles work well to block broad types of SQL actions. They decide who can log in and which tables that user can change. If an account lacks permission to remove data, it cannot empty a table. This setup protects your core tables from simple mistakes during routine tasks.
Still, static roles have clear limits in real engineering work. Sometimes an engineer needs the AI agent to clean up a staging table. If you grant that permission to the role, it stays active all the time. The database role cannot tell a safe single-row cleanup from a full wipe. It checks the table permission, not the intent of the individual SQL statement. Also, static database roles do not hide sensitive data in query results. When the agent runs a read query, it gets full rows back. Those rows might include emails, phone numbers, card numbers, or national IDs. Without field masking to rewrite matched fields in results, raw data reaches the model. Finally, local shell keys sit on the developer machine for any script to read.
End-to-End Encryption + CLI Authentication Patterns: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Why statement checks and data masking matter for AI agents
Safe AI database use requires checking each statement while it is in flight. Instead of relying only on broad table roles, teams inspect the exact query. An approval step can pause a risky command and ask a human to review. Meanwhile, safe read queries continue to run without extra friction for the developer. Adding data masking also rewrites emails and card numbers in query results. This approach keeps sensitive values out of prompts while letting the agent work.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev sits inline in the wire protocol beside those services as an open-source proxy, a sidecar for your Postgres or API. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Can native database roles block an update that overwrites data?
Yes, if you revoke update rights from the role used by the agent. Still, if the agent needs update rights, native roles cannot stop bad updates. A role allows or blocks all updates on a table, regardless of the filter.
Does terminal command approval stop all destructive database queries?
Manual approval lets you read a command before the agent runs it locally. Still, reviewers get tired and can miss a bad query inside a script. Relying only on human eyes in the terminal is risky for production data.
How can teams protect sensitive fields when the agent reads tables?
You can create restricted database views that leave out columns with personal data. Another option is using dynamic data masking to rewrite matched fields in results. This step replaces emails, phone numbers, or card numbers before the agent reads them.
Related guides
In this post