How to Configure Cursor ClickHouse Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a cursor clickhouse sandbox by creating a restricted database user. Then you point your local coding agent to that locked-down test instance. Engineering teams often connect AI assistants straight to shared data stores to move fast. Still, broad database roles let an agent read sensitive tables or drop production data. A single bad prompt can trigger a massive scan or alter live records. How a native cursor clickhouse sandbox works ClickHouse manages users, roles, row policies, set

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 cursor clickhouse sandbox by creating a restricted database user. Then you point your local coding agent to that locked-down test instance. Engineering teams often connect AI assistants straight to shared data stores to move fast. Still, broad database roles let an agent read sensitive tables or drop production data. A single bad prompt can trigger a massive scan or alter live records.

How a native cursor clickhouse sandbox works

ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access entities. To turn on SQL access control, an admin sets a storage directory on the server. At least one admin account also needs user management privileges enabled. That admin can only grant privileges that they already hold themselves.

When creating the sandbox user, the admin defines how the account logs in. The user creation statement also restricts which client hosts may connect to the server. You can attach default roles and specific settings profiles to that new agent user. To keep the agent contained, teams grant read rights only on specific test tables.

ClickHouse also supports column-level read grants for tighter data control. If you grant select rights on two columns, the user can only query those columns. Any query that asks for other columns will fail right away. A wildcard select across the whole table will also fail and return no data. It only works if the table holds just the granted columns. Recent ClickHouse versions also let admins grant rights across tables that share a name prefix.

How AI coding agents reach your database

AI coding tools like Cursor run queries through local Model Context Protocol servers or shell commands. A developer usually puts a database connection string inside a local config file. The agent reads that file and starts sending SQL queries to inspect schemas or data. Vendor guides urge teams to use a read-only database user in these connection strings. That way, the queries the AI runs cannot change or delete records.

Still, local config files create a major secret management problem for security teams. Every developer ends up storing raw database passwords in plain text on their laptop. If an agent can read the project folder, it can also read those stored credentials. Also, local shell tools can run database client commands directly if the user approves them.

ClickHouse Access Management + AI Sandbox Environments: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native database roles solve and what they miss

Native ClickHouse roles and column grants do a great job of blocking unauthorized table writes. They ensure that an AI agent can only log in from approved host addresses. They also stop the agent from reading columns that were left out of the grant. Quotas and settings profiles help cap how much compute a single user can burn.

Still, static database grants only check who logs in and which objects they touch. They cannot inspect what individual queries do in flight or why they were sent. If an allowed column holds emails, phone numbers, or card numbers, the query returns them raw. Static roles also require you to hand out long-lived credentials to every developer machine. And when five developers share one sandbox account, server logs cannot show which person ran a query.

Why runtime controls matter for agent workflows

Safe AI database workflows need controls that sit between the coding tool and the server. Developers should not keep static database passwords on their laptops just to test queries. Instead, each query should tie back to an individual user identity at runtime. Dynamic data masking can rewrite matched fields like national IDs or emails in query results. This lets the coding agent see valid column types while keeping sensitive strings out of prompts.

Add runtime guardrails and masking beside ClickHouse

Database grants and network rules control who can reach ClickHouse. Even so, an allowed client or agent can send an alter mutation that deletes rows or read raw personal data. In practice, hoop.dev sits inline in the native TCP protocol beside the server as a sidecar for your ClickHouse. For every production query an agent or human sends, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev ClickHouse support, guardrails refuse banned queries before they run or hold risky calls for approval, and data masking rewrites matched string columns in results in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Can a ClickHouse sandbox user run a wildcard select with column grants?

No, a wildcard select is refused when a user only has grants on specific columns. It only succeeds if the table contains nothing but the exact columns granted to that user.

How do you limit where a ClickHouse sandbox account can log in from?

When an admin runs the create user statement, they can specify allowed client hosts. ClickHouse will then reject login attempts from any IP address or host outside that list.

Why is a read-only database user not enough for AI coding agents?

A read-only user still exposes raw emails, phone numbers, and card numbers inside allowed tables. It also requires storing static credentials on developer laptops where local tools can read them.

The query runs. The emails stay hidden.