How to Configure Aider ClickHouse Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up aider clickhouse approval by pairing local shell checks with strict database roles. This setup asks a human to check commands before the agent runs queries. Teams often start by giving the coding agent a shared database key. When that role is too broad, one bad query can alter or drop tables. A safer plan splits local command checks from database user rules. How to set up aider clickhouse approval with native rules Aider works in your local shell and can suggest shell commands to r

Approval Chains & Escalation + ClickHouse Access Management: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up aider clickhouse approval by pairing local shell checks with strict database roles. This setup asks a human to check commands before the agent runs queries. Teams often start by giving the coding agent a shared database key. When that role is too broad, one bad query can alter or drop tables. A safer plan splits local command checks from database user rules.

How to set up aider clickhouse approval with native rules

Aider works in your local shell and can suggest shell commands to run. When the agent wants to run a database client command, it asks you first. You read the command text on your screen and choose to allow or skip it. This local check is the first layer of your aider clickhouse approval setup. It stops the agent from running shell scripts without your knowledge.

The second layer lives inside the ClickHouse database itself. ClickHouse manages users, roles, row policies, settings profiles, and quotas using SQL statements. To turn on SQL access control, an admin sets a storage directory path on the server. At least one admin account also needs user and collection control rights turned on. That admin can then create a dedicated user account just for the coding agent. Remember that a database user can only grant rights that they already hold themselves.

When you create the agent user, you define how it logs in. You can also lock down which host machines the user can connect from. You then attach default roles and settings profiles to keep the account small. Instead of giving full table access, you can grant read rights on single columns. If the agent only has rights on two columns, it can query only those two. A query asking for all columns with a star will fail and return no data. It only works if the table holds just those allowed columns. You can also grant read rights across matching table names using a trailing star prefix.

Where native database roles and local prompts fall short

Combining local terminal checks with column grants solves the basic login problem. It defines who can log in and which tables or columns they can touch. Still, this static setup leaves big gaps during day to day engineering work. Database roles check permissions at the table or column level, not per query intent. If an agent needs write rights to fix data, it gets write rights everywhere allowed.

Local terminal prompts also tire out developers over a long coding session. When an agent runs ten harmless read queries in a row, people stop reading closely. They start approving prompts out of habit just to keep their work moving fast. Then the eleventh command might include a bad write query or pull sensitive customer data. Because the user already holds the database password locally, the database lets the query run.

Approval Chains & Escalation + ClickHouse Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Why statement level checks matter for AI agents

Static roles also do not handle sensitive data fields well during live debugging. You might block a column to hide data, which breaks queries that select whole rows. If you allow the column so queries work, raw emails or phone numbers return in results. Raw card numbers or national IDs can also flow right back into the agent context. Native grants are all or nothing on each column you assign to the user.

Teams also lack a central audit trail when agents run queries from developer laptops. Local shell approvals happen on one machine and leave no team wide record. You can see that the shared agent user ran a query in server logs. Still, you cannot see who clicked approve or why the agent wrote that SQL statement. Fixing this gap requires moving approval and data masking to the query execution path.

Check ClickHouse queries and result columns on the wire

ClickHouse users and row policies decide who connects. They do not check each statement on the wire or redact sensitive string columns in query results. With hoop.dev, you run an open-source proxy, a sidecar for your ClickHouse, inline in ClickHouse's native TCP protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Multi-statement queries and table mutations are split and checked by hoop.dev guardrails, which refuse banned actions with a native ClickHouse error or hold risky ones for approval. On returned rows, hoop.dev data masking rewrites String and FixedString columns in memory, and the audit trail logs each query and verdict. See the MIT-licensed source on GitHub.

Frequently asked questions

Why does a select star query fail for a restricted ClickHouse user?

ClickHouse blocks select star queries when a user only has grants on specific columns. The query only works if the table contains nothing but those exact granted columns.

Can a ClickHouse user create another role with higher permissions?

No, ClickHouse prevents privilege escalation by enforcing a strict grant boundary. A database user can only grant rights that they already hold on their own account.

Do local terminal checks stop sensitive data from reaching the AI model?

No, approving a shell command lets the query run and return raw rows to the terminal. Any emails, phone numbers, or card numbers in those columns go straight into the agent session.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.