How to Configure JetBrains AI CockroachDB Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up jetbrains ai cockroachdb read only access by making a restricted database role. Then you add that user to the database tool inside your code editor. Teams often share broad admin keys in local editors to save setup time. Broad permissions let an AI assistant change or drop production tables by mistake. A read-only setup stops the editor from running write queries against your cluster. How jetbrains ai cockroachdb read only access works CockroachDB speaks the standard PostgreSQL wir

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 jetbrains ai cockroachdb read only access by making a restricted database role. Then you add that user to the database tool inside your code editor. Teams often share broad admin keys in local editors to save setup time. Broad permissions let an AI assistant change or drop production tables by mistake. A read-only setup stops the editor from running write queries against your cluster.

How jetbrains ai cockroachdb read only access works

CockroachDB speaks the standard PostgreSQL wire protocol for all client sessions. Your code editor uses a standard database driver to talk to the cluster. First, a database admin makes a dedicated user role inside the CockroachDB cluster. The admin grants select permissions on specific schemas and tables to this role. The admin also makes sure the role has no insert, update, or delete rights. Next, the developer opens the database panel inside the editor. The developer enters the cluster host, port, database name, and the read-only user key. The editor tests the link and pulls the table names into memory. When the developer asks JetBrains AI for help, the assistant reads this schema context. It uses table and column names to write SQL queries for the user. If the user runs a generated query, the database checks the role permissions first. CockroachDB blocks any statement that tries to change data or alter table structures.

How the editor uses database context

AI tools in your editor need schema details to write good SQL queries. Without schema context, the model guesses table names and writes broken code. The editor reads the system catalog tables using your database user role. It sends table names, column types, and foreign keys to the AI service. Sometimes developers also copy query results into the AI chat window to fix bugs. This workflow helps teams write complex joins and filter rules much faster. Still, the editor sends whatever data your database role is allowed to read. If the role can read all tables, the editor can read all rows too by default.

What native read-only roles solve and what they miss

Native database roles do a great job of stopping accidental writes and deletes. A read-only role stops an AI prompt from dropping a table or changing rows. This setup decides who can log in and which tables they can read. Still, static database roles do not inspect what individual queries do in flight. A read-only role still lets a user or assistant read sensitive customer records. If a table holds emails, phone numbers, or card numbers, the query returns them. Those raw results show up in the editor and may enter AI chat prompts. Static roles also rely on long-lived passwords stored on developer laptops. If a laptop is lost, the stored password remains valid until an admin rotates it. Finally, cluster logs only show the shared read-only role name for every query. Security teams cannot tell which developer or AI prompt ran a specific select statement. Teams need a way to mask sensitive fields and log each user action.

Auditor Read-Only Access + AI Model Access Control: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

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 beside the service as an open-source proxy, a sidecar for your database or API.

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 review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can JetBrains AI change data if it uses a read-only CockroachDB role?

No, the database blocks any write, update, or delete statement from a read-only role. Even if the AI writes a drop table command, CockroachDB rejects the query.

Does a read-only database role hide sensitive user data from the editor?

No, a standard read-only role returns all columns in the tables it can read by default. It will still return emails, phone numbers, card numbers, and national IDs in results.

How do teams grant read-only rights to new tables in CockroachDB?

Database admins set default privileges on the target schema inside the CockroachDB cluster. This rule gives the read-only role select rights on future tables created there.

The query runs. The emails stay hidden.