How to Configure Cursor ClickHouse Approval
You set up cursor clickhouse approval by combining local agent prompts with strict database roles. This dual setup stops AI coding assistants from running bad queries on live data. Many engineering teams start by giving their coding agent a shared admin account. That broad role lets the agent drop tables or read private user records by mistake. When permissions are too wide, one fast click in the editor can cause an outage. How native cursor clickhouse approval and role controls work AI codin
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 cursor clickhouse approval by combining local agent prompts with strict database roles. This dual setup stops AI coding assistants from running bad queries on live data. Many engineering teams start by giving their coding agent a shared admin account. That broad role lets the agent drop tables or read private user records by mistake. When permissions are too wide, one fast click in the editor can cause an outage.
How native cursor clickhouse approval and role controls work
AI coding agents reach external databases through local terminal tools or protocol servers. The coding editor asks the developer to review and approve tool actions before they run. Once the user clicks approve, the local tool sends the query to the database. At that point, the database server checks the credentials and applies its own rules.
ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL entities. An admin turns on SQL access control by setting a storage directory on the server. At least one account needs the right to manage access and named collections. A user can only grant the privileges that they already hold themselves.
When you create a user for an agent, you set the login method. You also define which hosts the user can log in from. You can assign default roles and specific user settings during creation. For safer reading, admins grant read rights on specific columns rather than whole tables. If a user only has rights on two columns, a full table query fails. The database refuses the broad query and returns no data at all. Admins can also grant rights across tables that share a name prefix.
What native controls solve and what they leave open
Native database roles and local editor prompts solve the first layer of risk. Editor prompts keep the agent from running shell commands or tool calls in secret. Database grants make sure a read-only user cannot delete tables or change schemas. Column grants also block the agent from reading unapproved columns in a table.
Still, this native setup leaves a major operational gap during live sessions. Database roles decide who can log in and which objects they can touch. They do not inspect what individual statements do in flight within allowed columns. If an agent has read access to a customer table, it can pull everything. The database returns raw emails, phone numbers, card numbers, and national IDs in full.
Approval Chains & Escalation + ClickHouse Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Local editor prompts also cause alert fatigue for busy developers. Developers often approve agent actions fast without reading every line of a complex query. Once the developer clicks approve, the agent runs the query using a static password. If an agent needs to run one safe update, the team must grant write rights. Those standing write rights stay active long after the single task finishes. Native controls cannot pause one risky query for a peer review on the fly.
Best practices for safer agent database sessions
Start by creating a dedicated database user just for your AI coding assistant. Never let the agent share a personal login or an app service account. Restrict the host rule so the account only logs in from trusted networks. Grant read access only to the specific tables and columns the agent needs.
Set strict quotas and settings profiles on that database role to cap resource use. This stops a bad agent query from using all memory on the cluster. Keep write privileges off the default role at all times. When the agent suggests a change, review the SQL text carefully before running it.
Check ClickHouse queries and results before execution
Access control in ClickHouse is essential setup. Setup alone does not check single queries for risk or rewrite sensitive strings in returned rows. By design, hoop.dev sits inline in the protocol beside the server as a sidecar for your ClickHouse. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.
First, hoop.dev guardrails block disallowed deletes, drops, and alter mutations or hold them for review. Then hoop.dev data masking rewrites sensitive string columns in responses in memory and logs each decision per resource. Read the docs and source on GitHub.
Frequently asked questions
Can ClickHouse restrict an AI agent to specific columns?
Yes, admins can grant read rights on specific columns in a table. The agent can query those exact columns, but full wildcard queries will fail.
Why is local editor approval not enough for database safety?
Local prompts only ask the developer running the editor to click yes. They do not rewrite sensitive fields like emails or card numbers in query results.
How do you limit where an agent account can log in from?
When creating a user in ClickHouse, you can define allowed client hosts. This rule blocks the account from logging in from unknown machines or networks.
Related guides
In this post