How to Configure Codex ClickHouse Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up codex clickhouse approval, pair native database roles with a human review step. You grant narrow SQL rights to the agent user and check queries before they run. Engineering teams often give coding agents broad credentials to speed up testing and debugging. When roles are too broad, a single bad prompt can drop tables or leak data. How codex clickhouse approval works with native SQL roles ClickHouse manages users, roles, row rules, settings profiles, and quotas as SQL access items. T

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 codex clickhouse approval, pair native database roles with a human review step. You grant narrow SQL rights to the agent user and check queries before they run. Engineering teams often give coding agents broad credentials to speed up testing and debugging. When roles are too broad, a single bad prompt can drop tables or leak data.

How codex clickhouse approval works with native SQL roles

ClickHouse manages users, roles, row rules, settings profiles, and quotas as SQL access items. To turn this on, an admin sets a storage folder on the database server. At least one admin user also needs access management rights turned on in settings. With this active, you can create a dedicated user account just for the agent.

Creating a new user requires the create user privilege on the server. A database user can only grant the exact rights that they already hold themselves. During setup, you pick how the user logs in and which hosts can connect. You also assign default roles and specific settings profiles to limit what the account does.

For tighter control, you can grant read rights on specific table columns only. If an agent only gets rights to two columns, it can query those two columns. Any query asking for a third column will fail right away. A select all query also fails unless the table holds only those granted columns. You can also use a trailing star to grant rights across tables sharing a prefix.

What native roles solve and what they leave open

Native roles and column grants decide who can log in and which objects they touch. They stop an agent from reading secret columns if you lock down every single table. They also stop writes when you assign a strict read-only role to the agent account. This gives your team a solid base layer of safety inside the database engine.

Still, static database roles cannot check what an individual SQL statement does in flight. Once an agent logs in, the database runs every permitted query without asking a human. An agent with write rights for a migration task can alter the wrong rows. Even a read-only query can scan billions of rows and slow down production apps.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static grants also treat every query the same once the user session starts. If a granted column holds emails, phone numbers, or card numbers, queries return them raw. The database does not pause a risky command to ask a team lead for approval. Teams have to maintain hundreds of fine-grained column grants as schemas change every week.

Why human review matters for AI database tasks

AI coding agents work fast and often chain several queries together to solve a problem. A local prompt in a code editor only shows the shell tool or script name. The reviewer might not see the exact SQL statement that the script will run next. Moving the approval step to the query level lets another engineer read the real SQL.

When teams review queries at the database boundary, they keep agent credentials very minimal. The agent uses a restricted role for safe daily reads without waiting on people. When the agent needs to change data or run a heavy query, it waits. A reviewer checks the exact statement and approves it for that one task only.

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 ClickHouse restrict an AI agent to specific columns?

Yes, admins can grant read rights on named columns inside a specific table. Queries that request other columns or ask for all columns will be refused.

What do I need to create a dedicated ClickHouse user with SQL?

You need SQL access control turned on with a storage folder set on the server. Your admin account also needs the create user privilege and access management rights.

Why is a read-only database user not enough for codex clickhouse approval?

A read-only user can still pull raw emails or card numbers from allowed columns. It can also run heavy queries without pausing for a human to check them first.

The query runs. The emails stay hidden.