How to Configure Goose ClickHouse Sandbox
You set up a goose clickhouse sandbox by creating a restricted database user. Then you limit that user with strict column grants and host rules. Teams often give local AI agents full database roles to move fast. Broad roles let an agent read private tables or drop data by mistake. A good test space stops bad queries before they cause harm. Setting up a goose clickhouse sandbox with SQL roles ClickHouse controls users, roles, row rules, settings, and quotas through SQL commands. To turn on SQL
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 goose clickhouse sandbox by creating a restricted database user. Then you limit that user with strict column grants and host rules. Teams often give local AI agents full database roles to move fast. Broad roles let an agent read private tables or drop data by mistake. A good test space stops bad queries before they cause harm.
Setting up a goose clickhouse sandbox with SQL roles
ClickHouse controls users, roles, row rules, settings, and quotas through SQL commands. To turn on SQL access control, the server needs a storage path. You also need at least one admin user with access management rights enabled. An admin can only grant rights that they already hold themselves. Making a new user for the agent requires the user creation right.
When you create the agent account, you pick how it logs in. You can also restrict which host addresses the agent can use. This keeps the local AI tool tied to a known machine. You can assign default roles and specific settings to that user account too. These controls form the base of a safe goose clickhouse sandbox.
Next, you lock down which tables and columns the agent can read. ClickHouse lets you grant read rights on single columns in a table. If an agent only gets rights to two columns, it can query those. Queries that ask for any other column will fail right away. A full table wildcard query will also fail and return zero data. That wildcard query only works if the user holds rights to every column by default. You can also grant rights across tables that share a name prefix.
Why native roles leave gaps for AI agents
Native database roles decide who can log in and which objects they touch. They work well when a human engineer writes predictable queries by hand. An AI agent like Goose acts very differently during a task. It explores schemas, tests queries, and reads rows to plan its next step. Static column grants take a lot of work to keep up to date.
If you block one column, the agent breaks when it runs a wildcard query. Because of this, teams often give the agent read rights on full tables. Once the agent can read a full table, sensitive fields flow into prompts. Phone numbers, emails, card numbers, and national IDs can end up in logs. Native user rules cannot rewrite those fields inside query results on the fly.
ClickHouse Access Management + AI Sandbox Environments: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Database roles also treat every allowed command the same way at runtime. Once the agent logs in, it can run any query its role allows. You cannot pause a risky command for human approval before it runs. You also have to store a database key on the user machine. Keeping keys on laptops creates extra risk if a file leaks.
Managing agent query risk in daily work
A safer setup separates database identity from what happens inside each session. Start by keeping your native user account limited to read rights. Only expose the test schemas that the agent needs for its job. Set quotas on the user so heavy analytical queries do not slow the cluster. Restrict the host rule so the account only works from approved networks.
Then think about how data moves back to the AI model. Even test databases often hold copies of real emails or card numbers. Masking rules that rewrite matched fields in results help reduce data exposure. The agent still gets valid table shapes, so its queries do not break. Your team gets fast answers from the agent while keeping sensitive strings safe.
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 beside the server as a sidecar for your ClickHouse and parses every statement before execution.
First, hoop.dev guardrails block disallowed deletes, drops, and alter mutations. Then hoop.dev data masking rewrites sensitive string columns in responses and logs each decision per resource. Read the docs and source on GitHub.
Frequently asked questions
Why do wildcard queries fail in a restricted ClickHouse account?
When you grant read rights on specific columns only, ClickHouse blocks wildcard queries. A wildcard query only works if the user holds rights on every single column.
How do you turn on SQL role management in ClickHouse?
You must set a storage directory path on the server first. You also need at least one user account with access management rights turned on.
Can a ClickHouse user grant permissions to the Goose agent account?
Yes, if that user holds the right to create users or grant access. Still, a user can only grant privileges that they already hold themselves.
Related guides
In this post