How to Configure JetBrains AI ClickHouse Least Privilege

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up jetbrains ai clickhouse least privilege by making a read-only database user. Then you limit that user to specific tables and columns using SQL grants. Many engineering teams connect their IDE coding assistants using shared admin accounts. This approach is fast, but it creates huge risks for your data. An assistant with broad rights can read sensitive columns or drop production tables. Scoping down permissions keeps your analytical data safe while developers write queries. Setting up

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 jetbrains ai clickhouse least privilege by making a read-only database user. Then you limit that user to specific tables and columns using SQL grants. Many engineering teams connect their IDE coding assistants using shared admin accounts. This approach is fast, but it creates huge risks for your data. An assistant with broad rights can read sensitive columns or drop production tables. Scoping down permissions keeps your analytical data safe while developers write queries.

Setting up jetbrains ai clickhouse least privilege in SQL

ClickHouse manages users, roles, row policies, settings profiles, and quotas as access entities. You can create and manage all of these entities using standard SQL statements. First, you must turn on SQL-driven access control on your database server. This setup needs a storage folder path set on the server. It also requires at least one user with access management rights turned on. Named collection control must also be set for that initial admin account.

Once that is ready, an admin with user creation rights can make a new account. A user can only grant the privileges that they hold themselves. During user creation, you set the login method for the IDE assistant. You also define the specific hosts the user can log in from. You can assign default roles and custom settings profiles at the same time.

Next, you restrict what data the IDE assistant can read. ClickHouse lets you grant read rights on specific columns in a table. If you grant read access on two columns, the user can query only those two. Queries asking for other columns in that table will fail right away. A wildcard query asking for all columns will also be refused. It returns no data unless the table holds only the permitted columns. In newer releases, you can also grant access across tables sharing a name prefix. You do this by placing a trailing asterisk on the table name.

Why native roles are only the first step

Native database roles and column grants solve the basic problem of broad table access. They stop an IDE coding assistant from reading restricted tables or dropping schemas. They also block logins from unknown hosts outside your office or network.

Still, static database grants only check who logs in at the start. They do not inspect what individual queries do while running in flight. A developer might need to query a user table to help build a feature. If an email column is allowed, the query returns raw emails to the IDE. The assistant might then send those raw emails or phone numbers to external models. Also, column grants require manual updates every time your table schemas change. Teams often fall back to full table grants because wildcard queries fail on partial grants. Static roles also store database passwords right inside the local IDE settings on laptops.

Least Privilege Principle + ClickHouse Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing query risks in everyday development

To keep data safe, teams should pair database roles with runtime controls. Start by creating a dedicated role just for IDE assistants and coding tools. Never let developers reuse service accounts from production apps for their local tools. Grant read access only to the schemas needed for daily coding work.

When tables contain emails, card numbers, or national IDs, avoid granting full table access. Give the assistant access only to safe columns like timestamps, counts, and status codes. If developers must query tables with sensitive fields, use tools that rewrite matched fields in results. This keeps real customer details out of coding prompts while keeping queries working. Review your database roles every month to remove unused table grants.

Check ClickHouse queries and result columns on the wire

ClickHouse users and row policies decide who connects. They do not check each statement on the wire or redact sensitive string columns in query results. With hoop.dev, you run an open-source proxy, a sidecar for your ClickHouse. It reads ClickHouse's native TCP protocol before queries run while ClickHouse stays in charge of login and grants.

Multi-statement queries and table mutations are split and checked by hoop.dev guardrails. Banned actions are refused with a native ClickHouse error. On returned rows, hoop.dev data masking rewrites String and FixedString columns that match your rules. The audit trail logs each query, table, and verdict. See the MIT-licensed source on GitHub.

Frequently asked questions

Why do wildcard queries fail when using ClickHouse column grants?

ClickHouse blocks wildcard queries when a user only has access to specific columns. The query returns no data unless the table contains only those permitted columns. Developers and AI tools must list the allowed column names in every query.

What server settings are needed for SQL access control in ClickHouse?

You must configure a storage directory path on the ClickHouse server for access files. You also need at least one user account with access management rights turned on. That admin user can then create restricted accounts and roles using SQL.

How can we protect emails and card numbers from IDE assistants?

First, use column grants to exclude columns holding emails, phone numbers, or card numbers. Second, add a step that rewrites matched fields in results before data reaches the IDE. This lets developers test queries on real schemas while protecting sensitive customer values.

The query runs. The emails stay hidden.