How to Configure Codex ClickHouse Credentials

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up codex clickhouse credentials by making a read-only database user with SQL grants. Then you pass those login details to the agent runtime so it can query tables. Many teams start by sharing an existing admin account to save time during setup. That broad role lets an automated coding tool alter tables or read every row by default. How to set up codex clickhouse credentials in your database ClickHouse manages users, roles, row rules, settings profiles, and quotas through SQL access en

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 codex clickhouse credentials by making a read-only database user with SQL grants. Then you pass those login details to the agent runtime so it can query tables. Many teams start by sharing an existing admin account to save time during setup. That broad role lets an automated coding tool alter tables or read every row by default.

How to set up codex clickhouse credentials in your database

ClickHouse manages users, roles, row rules, settings profiles, and quotas through SQL access entities. Before you create accounts with SQL, you must set up a storage directory on the server. You also need at least one initial account with user management permissions turned on. That admin user can only grant database privileges that it already holds itself.

Creating a new user account takes a specific user creation privilege inside the database. During account creation, you pick the login method and list the allowed client hosts. You also assign default roles and apply per-user settings profiles to that new account. For an AI coding agent, teams should create a dedicated account with read-only permissions.

You can limit read permissions to specific columns inside a single database table. When a user only has grants for two columns, queries on other columns fail. Running a wildcard query for all columns also fails and returns no data at all. The wildcard query only works if the table holds just those granted columns. Newer database versions also let you grant read access across table name prefixes.

How AI coding agents use database login details

AI coding tools run queries by reading login details from local files or shell variables. Some agents reach external data sources through local tool servers or built-in shell runners. When an agent runs a command, it uses the static user and secret on disk. The database checks the host and password, then opens a session for that user.

Storing plain login strings on developer laptops creates a real risk for engineering teams. If an agent reads project files, it can pull those raw secrets into its context. Any script or shell command that the agent runs inherits those same database permissions. A mistake in a prompt can trigger a bad query across every allowed table.

Ephemeral Credentials + ClickHouse Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native database roles solve and what they miss

Native database roles and column grants do a good job of blocking unwanted table writes. They stop an agent from dropping tables or reading restricted columns that lack explicit grants. Quotas and settings profiles also help limit how much memory or time a query uses. These built-in tools decide who can log in and which objects they can touch.

Still, static database roles leave big gaps open during daily work with coding agents. First, the user secret still sits on the client machine where tools can read it. Second, column grants are rigid and fail when an agent runs a broad wildcard query. Third, a granted column might still hold private emails, phone numbers, card numbers, or national IDs.

Once a column grant allows read access, the database sends every raw value back. Native access control does not rewrite matched fields in results to hide private user data. It also cannot ask a human to approve one risky query in the middle of a session. Teams have to choose between blocking whole columns or exposing raw text to the agent.

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

Why do wildcard queries fail when using column grants in ClickHouse?

ClickHouse blocks wildcard queries when a user only has grants on a few specific columns. The query returns no data unless the table contains only the columns granted to that user.

How can I stop an AI agent from changing data in ClickHouse?

Create a dedicated database user with SQL access control and grant only read permissions. Assign a settings profile and quota so the agent cannot run heavy writes or changes.

What is the risk of putting database secrets in agent config files?

Local config files store static passwords in plain text on the developer machine or server. The coding agent or any local script can read and leak those secrets in logs.

The query runs. The emails stay hidden.