How to Configure Devin ClickHouse Guardrails

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up devin clickhouse guardrails by creating scoped SQL roles, quotas, and settings profiles. This setup restricts what tables and columns an AI agent can read or change. Engineering teams often give an agent a broad database account to start fast. That wide account lets an autonomous agent run bad writes or read sensitive columns. It also makes it hard to tie a bad query to one task. How native devin clickhouse guardrails work in SQL ClickHouse manages users, roles, row policies, setti

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 devin clickhouse guardrails by creating scoped SQL roles, quotas, and settings profiles. This setup restricts what tables and columns an AI agent can read or change. Engineering teams often give an agent a broad database account to start fast. That wide account lets an autonomous agent run bad writes or read sensitive columns. It also makes it hard to tie a bad query to one task.

How native devin clickhouse guardrails work in SQL

ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access entities. To turn on SQL access control, an admin sets a storage directory on the server. At least one admin account needs permission to manage access and named collections. An admin can only grant privileges that they hold themselves. Creating a new account also takes explicit user creation rights.

When you create an account for Devin, you define how it logs in. You can also limit which hosts the agent can connect from. You then assign default roles and specific settings profiles to that account. For safer reads, you can grant read rights on specific columns only. The agent can then query only those allowed columns in that table.

If the agent queries a restricted column, the database refuses the query. A wildcard query across all columns also fails and returns no data. It only works if the table holds just the allowed columns. Since version 24.10, a trailing asterisk grants rights by table name prefix. This helps teams group agent tables under one safe prefix.

Why static database roles fall short for AI agents

Native roles and column grants work well for fixed apps with predictable queries. They check who logs in and which tables or columns are off limits. Still, an autonomous coding agent does not run fixed queries. It writes new SQL statements on the fly as it debugs code. Static roles cannot tell a safe debug query from a risky one.

Column grants also force a rigid trade-off when tables hold sensitive text. If an agent runs a wildcard query, the database blocks the whole query. The agent hits an error instead of getting safe rows with redacted fields. Native access entities do not rewrite emails, phone numbers, or card numbers in results. They either allow the column in full or block the query.

ClickHouse Access Management + AI Guardrails: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static credentials also create an audit gap when multiple developers run agents. Every agent session uses the same database user and host rule. Database logs show the shared agent account, not the human who started the task. When an agent needs temporary write rights for a migration, teams must alter grants by hand. If someone forgets to revoke those grants, the agent keeps write rights forever.

Key steps for safe agent query control

A strong setup pairs native database roles with checks on each query in flight. Start by giving the agent account a role with read rights on safe tables. Use settings profiles and quotas to cap memory use and query run time. This stops a bad join from hurting production analytical workloads.

Next, add controls that check individual statements before they reach the database server. Write commands and schema changes should pause for a human to review and approve. Read results should pass through field masking to rewrite national IDs or card numbers. This lets the agent inspect production data shapes while keeping raw personal fields safe.

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

What happens when Devin runs a wildcard query on a column-restricted ClickHouse table?

ClickHouse refuses a wildcard select query unless the table holds only the granted columns. The query returns an error and no data instead of partial columns.

How do you enable SQL-driven access control for agent accounts in ClickHouse?

You set the access control storage directory on the server and enable access management on an admin user. That admin can then create roles, users, quotas, and row policies with SQL.

Can native ClickHouse roles mask sensitive fields like emails or card numbers in query results?

No, native column grants only allow or block access to a column. Rewriting emails, phone numbers, or card numbers in results requires runtime data masking.

The query runs. The emails stay hidden.