How to Configure GitHub Copilot ClickHouse Guardrails

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up github copilot clickhouse guardrails by creating strict SQL roles and read-only users. You also limit which columns and tables the AI coding agent can read. Many teams give their coding assistant a shared database account to speed up local work. This broad role lets the agent run heavy scans or change live tables by mistake. How to set up native github copilot clickhouse guardrails ClickHouse manages users, roles, row rules, settings profiles, and quotas as SQL access items. To tur

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 github copilot clickhouse guardrails by creating strict SQL roles and read-only users. You also limit which columns and tables the AI coding agent can read. Many teams give their coding assistant a shared database account to speed up local work. This broad role lets the agent run heavy scans or change live tables by mistake.

How to set up native github copilot clickhouse guardrails

ClickHouse manages users, roles, row rules, settings profiles, and quotas as SQL access items. To turn on SQL access control, an admin sets up a local storage path. The admin also gives at least one user the right to manage access rules. A user can only hand out rights that they hold on their own account.

Once SQL management is active, you create a dedicated account for your coding assistant. Creating this account takes the create user right inside the database engine. During setup, you pick the login method and list the allowed client hosts. You also assign default roles and attach a strict settings profile to the account.

Next, you restrict what data the agent account can read during a coding session. ClickHouse lets you grant select rights on specific columns instead of the whole table. The agent can then query only the allowed columns that you picked. If the agent tries to select all columns with a star, the query fails. That star query only works if the table holds just the allowed columns. Since version 24.10, you can also grant rights across tables that share a name prefix.

How row rules and quotas limit agent queries

Column grants hide whole fields, but shared tables often hold sensitive rows too. You can add row policies in SQL to filter which rows the agent sees. A row policy acts like a fixed filter on every select statement the user runs. This rule keeps test accounts focused on sample rows instead of full customer logs.

AI coding agents can also fire many fast queries while they test code fixes. ClickHouse quotas let you cap resource use over a set time window. You can attach a quota and a settings profile to the agent role. This step stops a single coding prompt from eating all cluster memory or CPU.

ClickHouse Access Management + GitHub Actions Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Where native database roles fall short for AI agents

Native roles and column grants decide who can log in and which objects exist. Still, static grants cannot inspect what an individual query does while it runs. An agent with read rights on a user table still pulls raw text values. If an allowed column holds emails, phone numbers, card numbers, or national IDs, they return in clear text. Static column blocks also break queries when a developer needs the column structure to stay intact.

Local credential storage creates another big risk for engineering teams using coding tools. When you give an agent a database password on a laptop, that secret sits in plain files. Any local script or terminal command the agent runs can read that stored password. Static database roles also do not link individual SQL statements back to a developer identity. Teams need a way to check queries in flight and rewrite sensitive fields in results.

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 block an AI agent from running select star queries?

Yes, granting select rights on specific columns blocks full star queries on that table. ClickHouse refuses the star query unless the table contains only the granted columns.

How do you stop GitHub Copilot from changing data in ClickHouse?

Create a dedicated SQL user and grant only select rights on safe tables or columns. Attach a read-only settings profile so the account cannot run inserts or schema changes.

Why are column grants not enough to protect emails and card numbers?

Column grants are all or nothing, so any allowed column returns raw data in full. Dynamic data masking is needed to rewrite emails or card numbers inside query results.

The query runs. The emails stay hidden.