How to Configure Goose CockroachDB Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up goose cockroachdb read only access by making a restricted database role. Then you pass those role keys to the agent tool so it can only read data. Many teams start by giving their AI agent full admin rights to test things out. That broad setup puts live tables at risk because the agent can change or delete rows. How goose cockroachdb read only access works Goose is a local developer agent that runs tasks on your machine. It uses plugins and system tools to talk to external data sto

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 read only access by making a restricted database role. Then you pass those role keys to the agent tool so it can only read data. Many teams start by giving their AI agent full admin rights to test things out. That broad setup puts live tables at risk because the agent can change or delete rows.

How goose cockroachdb read only access works

Goose is a local developer agent that runs tasks on your machine. It uses plugins and system tools to talk to external data stores. CockroachDB is a distributed SQL database that uses role-based rules to control user actions. To link them safely, you first make a dedicated user role inside the database.

Database admins grant this role select privileges on target schemas and tables. You must also set default rules so future tables stay readable by this role. Next, you give the agent the database host details and the read-only user keys. When the agent runs a task, it logs into the cluster using those restricted keys.

The database checks the role rules before it runs any query from the agent. If the agent tries to run an insert or drop command, the database blocks it. The agent can still inspect table schemas and read rows to answer your questions. This basic setup stops accidental writes while letting the AI help with code and data checks.

What native database roles solve and what they miss

Native database roles are great at stopping write commands at the storage engine level. They make sure a rogue prompt cannot drop a table or alter billing records. Still, native roles only check who logs in and what table they touch. They do not inspect what individual statements do in flight or what data comes back.

A read-only role can still pull every row from a sensitive customer table by default. If a table holds emails, phone numbers, card numbers, or national IDs, the query returns them. The local agent then sends those raw results straight to an external model provider. Native roles cannot rewrite matched fields in results to hide private data on the fly.

Static keys on developer laptops also create a big security risk for your team. To use the database, the developer must store a password or certificate on their disk. If that file leaks, anyone can use it to read your live database tables. Rotating those keys across dozens of laptops takes a lot of manual work.

Auditor Read-Only Access + Customer Support Access to Production: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing query load and audit trails for AI agents

Read-only queries can still hurt database performance if they scan too much data. AI agents often write bad joins or run full table scans without row limits. In a distributed database, a heavy read query can use up CPU across many nodes. That load slows down live traffic for your real users and apps.

Tracking what the agent did is also hard when teams share one read-only role. The database log only shows the shared role name, not the human who ran the agent. Security teams cannot tell which developer asked the AI to pull a specific table. You need a way to tie every single query back to a real person.

Teams also need to set strict limits on how many rows a query can return. Stopping huge data dumps keeps both your cluster fast and your private records safe. Putting controls around the query path fixes the gaps that simple database roles leave open.

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 runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values 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 a read-only database role stop an AI agent from reading private data?

No, a read-only role gives the user full read access to the entire table. If the table has emails or card numbers, the database returns them in plain text. You need data masking to rewrite matched fields in results before the agent gets them.

Why can read-only queries from an AI agent still slow down a cluster?

An AI agent might write a query that scans millions of rows without using an index. Even though the query does not write data, it still uses heavy memory and CPU. This extra load can starve your main app and slow down normal user requests.

How should teams handle database keys for local AI developer tools?

Teams should avoid saving long-lived database passwords in plain text files on user laptops. Instead, developers should log in with their own work identity when they start a task. This approach removes static keys from disks and makes audit logs much clearer.

The query runs. The emails stay hidden.