How to Configure Goose CockroachDB Permissions

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up goose cockroachdb permissions by creating a dedicated database role for the agent. Then you grant that role read or write rules on specific tables and schemas. Many teams rush this step and give the AI agent a full admin account. Broad roles let an autonomous tool drop tables, change schemas, or read private customer records. How goose cockroachdb permissions work in practice Goose is a local developer agent that runs shell scripts and database queries. It connects to your Cockroac

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 goose cockroachdb permissions by creating a dedicated database role for the agent. Then you grant that role read or write rules on specific tables and schemas. Many teams rush this step and give the AI agent a full admin account. Broad roles let an autonomous tool drop tables, change schemas, or read private customer records.

How goose cockroachdb permissions work in practice

Goose is a local developer agent that runs shell scripts and database queries. It connects to your CockroachDB cluster using a standard database user and a secret key. CockroachDB uses role-based controls to check what that user can do after logging in. You create a custom role for the agent and assign privileges at the table level. For safe read tasks, you grant select rules on the target tables only. If the agent needs to fix data, you add insert or update privileges. You also revoke system rules so the agent cannot change cluster settings or user roles. Once you set up the role, you pass the login string to the local environment. The agent then reads that local string to open a session and run SQL commands.

What native database roles solve and what they miss

Native CockroachDB roles do a great job of blocking unauthorized users at login time. They stop the agent from touching tables or schemas outside its assigned scope. Still, database roles only check who logs in and which general table rules apply. They do not inspect what individual statements or queries do while in flight. If the agent has select rules on a user table, it can pull every row by default. That query result might include raw emails, phone numbers, card numbers, or national IDs. A static role cannot rewrite matched fields in results before they reach the AI model. Also, a role with update rules allows the agent to run a bad update query. Native roles lack per-query approval workflows to pause risky commands before they run. Plus, storing database keys in local files on developer laptops creates a credential leak risk. Teams need a way to inspect queries and mask sensitive fields in real time.

Scoping agent tasks for safer database work

To reduce risk with native controls, teams split agent duties into separate database roles. You can make one role for schema checks and another role for data reads. The schema role only reads metadata tables so the agent can learn your table structure. The data role reads specific business views that exclude sensitive columns like card numbers. You should also set query time limits and row limits on the agent role. This stops a bad AI prompt from triggering a huge scan that slows the cluster. Even with split roles, managing local keys across a large engineering team stays hard. Rotating those local keys every week takes manual work and often breaks local agent setups.

AI Agent Permissions + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

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

Should I give my AI agent admin rules in CockroachDB?

No, you should never give an AI agent admin rules in any database cluster. Always create a narrow role with read rules on the exact tables needed.

How do I stop Goose from reading private user columns?

With native tools, you must build separate database views that leave out sensitive columns. Otherwise, you need runtime data masking to rewrite emails or phone numbers in query results.

Where does Goose store the CockroachDB login string?

The agent reads the database login string from local files or shell variables on your machine. Leaving plain keys in local files creates a risk if a laptop gets lost.

The query runs. The emails stay hidden.