How to Configure Windsurf CockroachDB Least Privilege

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up windsurf cockroachdb least privilege, create a scoped database role first. Then let the coding agent use only that limited role during tasks. Note that Cognition renamed Windsurf to Devin Desktop on June 2, 2026. The tool keeps the same IDE and features under the new name. Its agent can run terminal commands on its own with user approval. It also uses Model Context Protocol servers to reach external systems. Many teams give their local database user full admin rights for speed. If the

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.

To set up windsurf cockroachdb least privilege, create a scoped database role first. Then let the coding agent use only that limited role during tasks. Note that Cognition renamed Windsurf to Devin Desktop on June 2, 2026. The tool keeps the same IDE and features under the new name. Its agent can run terminal commands on its own with user approval. It also uses Model Context Protocol servers to reach external systems. Many teams give their local database user full admin rights for speed. If the agent inherits those broad rights, a bad query can drop tables. It can also pull sensitive customer rows into the chat window.

How windsurf cockroachdb least privilege works in practice

Setting up windsurf cockroachdb least privilege starts inside the database cluster. An admin creates a dedicated role just for the coding agent. This role should not own tables or change cluster settings. Instead, the admin grants read rights on only the needed tables. If the agent must test writes, grant write rights on one test schema. Never reuse a human admin account or an app service account.

Next, you connect the IDE to the database using that restricted role. In Devin Desktop, the agent runs commands in a dedicated terminal. It uses zsh on macOS and bash on Linux. That terminal loads the user's normal shell files. This means local aliases and shell variables are open to the agent. If your shell files store a root database URL, the agent can use it. Keep root credentials out of your default shell startup files. Place only the restricted role credentials where the agent or its MCP server looks.

What native roles solve and what they miss

Native database roles stop the biggest mistakes right at the cluster door. A read-only role stops the agent from deleting rows or changing schemas. It also blocks the agent from creating new database users. If the agent hallucinates a destructive command, the database rejects it right away. This gives your team a strong baseline for daily coding work.

Still, static database roles only check who logs in at the start. They do not inspect what individual queries do once the session begins. A read-only role still lets the agent read every row in an allowed table by default. If that table holds customer emails, phone numbers, or card numbers, they return in full. The agent then reads those raw values and sends them to the model. Also, a static role stays active on the laptop all day. If a prompt demands a risky write on an allowed table, no approval step pauses it. Finally, cluster logs only show queries coming from one shared role name. Teams must match local chat logs with database logs to see what happened.

Least Privilege Principle + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Steps to tighten local agent database rules

Start by auditing what shell variables load when you open a new terminal. Remove any admin database strings from your main profile files. Create a separate database user that only has select grants on safe tables. Keep sensitive tables out of that role's grant list from day one.

Always keep command approval turned on inside the IDE settings. Check every terminal command before you let the agent run it. Watch out for commands that dump whole tables or change schema state. When you use an MCP server for database tasks, point it to the restricted user. Rotate that user's password often so old keys do not linger on laptops.

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

Did Windsurf change its product name?

Yes, Cognition renamed Windsurf to Devin Desktop on June 2, 2026. The product keeps the same IDE features, and old docs links now redirect.

Why can the agent see my local database credentials?

The agent runs commands in a dedicated terminal that loads your shell setup. Any variables or aliases in your zsh or bash files are available to it.

Does a read-only CockroachDB role protect customer data from the model?

No, a read-only role still returns full rows from any permitted table. You need field masking to rewrite emails, phone numbers, or card numbers in results.

The query runs. The emails stay hidden.