How to Configure Gemini CLI CockroachDB Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a gemini cli cockroachdb approval flow by pairing local agent prompts with database roles. This requires the agent to pause before it runs any query against your cluster. Engineering teams often give AI agents a local database user with broad write rights. That choice lets the assistant fix bugs fast, but one bad prompt can drop tables. When permissions are too wide, the agent can also read sensitive customer rows by mistake. How a native gemini cli cockroachdb approval setup works

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 approval flow by pairing local agent prompts with database roles. This requires the agent to pause before it runs any query against your cluster. Engineering teams often give AI agents a local database user with broad write rights. That choice lets the assistant fix bugs fast, but one bad prompt can drop tables. When permissions are too wide, the agent can also read sensitive customer rows by mistake.

How a native gemini cli cockroachdb approval setup works

The command-line agent runs inside your local terminal and reads your active shell variables. When you ask the model to inspect a schema, it drafts a shell command. It can also call a configured tool server that talks to your CockroachDB cluster. By default, the terminal agent asks the user to confirm before running shell tools. You see the proposed command on your screen and press a key to allow it.

On the database side, admins create specific SQL roles to limit what that session does. You can grant read rights on public tables while blocking changes to core billing schemas. The local client uses a stored key or password from the user shell to log in. Once the user approves the terminal prompt, the client sends the SQL statement over the network. CockroachDB checks the role privileges and runs the query if the user has rights.

What native controls solve and what they leave open

This two-part setup stops the agent from running silent commands without your knowledge. Local terminal prompts force a human to look at the command string first. Database roles also stop a read-only user from deleting tables or changing cluster settings. Together, these native features handle basic login checks and coarse table permissions well.

Still, local confirmation prompts and static database roles leave big operational gaps for teams. Developers often get tired of reading every prompt and turn on auto-approve modes for speed. Even when a developer reads the screen, a long SQL script can hide risky changes. Also, a local prompt only asks the person running the tool, not a team lead. You cannot ask a peer to review a risky production write from a laptop terminal.

Approval Chains & Escalation + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static database roles also decide who logs in, not what each statement does in flight. If an agent needs write rights for one table, it keeps those rights all day. And if a table holds emails, phone numbers, or card numbers, SELECT queries return them. Standard roles return the whole column unless you build extra views for every table.

Why team review matters for AI database tasks

AI coding tools write and run queries much faster than humans type them. A single task might run ten schema checks and three data updates in one minute. Relying on one developer to inspect every raw terminal command in real time fails fast. Teams need a way to inspect each query and require peer sign-off for writes. They also need a way to mask sensitive fields like national IDs in query results. Moving approval checks out of the local terminal gives security teams clear audit logs.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can the Gemini agent run CockroachDB queries without asking me first?

Yes, if a user enables automatic execution modes in their local tool settings. By default, the agent asks for confirmation in the terminal before running shell commands.

Do standard CockroachDB roles hide sensitive columns from AI agents?

No, standard table grants allow access to all columns in that table at once by default. To hide emails or card numbers natively, you must create and manage separate SQL views.

Why are local terminal prompts not enough for production database changes?

Local prompts only ask the person sitting at the keyboard to approve their own request. They do not require a second team member to review risky commands or log approvals centrally.

The query runs. The emails stay hidden.