How to Configure Goose ClickHouse Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up goose clickhouse approval by pairing scoped database roles with human query checks. This setup stops your AI agent from running bad commands without a review. Most teams start by giving their agent a shared login key. That quick setup lets the agent read and change any table right away. Broad roles create big risks when an agent guesses a table name wrong. One bad prompt can wipe data or pull private records into the chat log. How native permissions support goose clickhouse approval

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 goose clickhouse approval by pairing scoped database roles with human query checks. This setup stops your AI agent from running bad commands without a review. Most teams start by giving their agent a shared login key. That quick setup lets the agent read and change any table right away. Broad roles create big risks when an agent guesses a table name wrong. One bad prompt can wipe data or pull private records into the chat log.

How native permissions support goose clickhouse approval

ClickHouse manages users, roles, row rules, settings profiles, and quotas as access objects. You can build and manage all of these objects with SQL statements. To turn this on, the server needs a storage path for access data. You also need at least one admin user with access management turned on. That user also needs named collection control set to one.

An admin can only give out rights that they already hold themselves. Making a new account for your AI agent takes the user creation privilege. During setup, you pick how the account logs in and which hosts it uses. You also assign default roles and specific user settings for that agent account.

To keep the agent safe, you can grant read rights on specific columns only. The agent can then query those allowed columns, while other columns stay off limits. If the agent tries to select all columns with a star, the database refuses. That broad query returns no data unless the user has rights on every column. In newer versions, you can also grant read rights across tables using name prefixes.

What native roles solve and what they miss

Native database roles and column grants do a great job of limiting static access. They decide which account can log in and which tables that account can touch. If the AI agent tries to read a blocked column, the database stops it. This static boundary keeps an agent inside its assigned lane during normal work.

Still, static database roles cannot check what a specific query does in flight. Once the agent logs in, every allowed query runs right away without a pause. The database does not know if a query is safe or way too big. It cannot pause a risky command to ask a human for a quick check.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Native grants also return raw text for every column the agent is allowed to read by default. If an allowed column holds emails, phone numbers, or card numbers, those values flow out. Static roles cannot rewrite matched fields in results while a query runs. Teams need a way to pause risky commands and mask sensitive fields like national IDs.

Setting up a safe workflow for agent queries

A strong setup combines narrow database grants with a live check on every query. First, create a dedicated database user for the Goose agent with read grants only. Limit those read grants to the exact tables and columns the task requires. Never give the agent an admin account or broad rights across the whole server.

Next, place a step in front of the database to catch queries in flight. When the agent sends a command, the workflow can pause and ask a team member. A human reads the exact statement and approves or denies it before it runs. This step gives you true query review without rewriting your database roles every hour.

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 runs beside the server as a sidecar for your ClickHouse and checks native TCP queries with no change to your drivers.

With hoop.dev ClickHouse support, guardrails refuse banned queries before they run, and data masking rewrites matched string columns in results. The audit trail logs which entity types were masked and how many without storing raw values. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Can ClickHouse pause a query from Goose for human review on its own?

No, native ClickHouse permissions only check if a user has the right to run a statement. If the role allows the command, the database runs it right away without waiting.

What happens if Goose runs a select star query on a table with column grants?

ClickHouse blocks the select star query and returns no data at all. The query only works if the user has read grants on every column in that table by default.

How should we scope the ClickHouse user account for an AI agent?

Create a dedicated user with SQL access control and limit the hosts it can use. Grant read rights only on the specific tables and columns the agent needs.

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.