Skip to content
Databases & keys · Secret guide

Leaked ClickHouse Cloud API Key: what to do in the first hour

Critical severityDetected onlyLast verified · 4 min read

A ClickHouse Cloud API key is made to drive the control plane of your organization through the Cloud API: listing, creating, changing and deleting services, and managing other settings, according to the role given to the key. A key with a broad role can start expensive services, delete production ones or read configuration, which is a threat to both your data and your invoice. The key is a pair: a key ID and a key secret. Delete the key first, then investigate what it did.

Check your GitHub account for leaked secrets — free

Provider
ClickHouse Cloud
Severity
Critical
Impact
SaaS account access and billing
Checked live by LeakWatch
No

What a ClickHouse Cloud API Key looks like

The Cloud API uses basic authentication with the key ID as the user name and the key secret as the password. The key ID is the visible, recognizable half: the four characters 4b1d followed by 38 letters and digits, 42 characters in all:

4b1dXXXX…   ClickHouse key ID (masked: 4b1d + 38 alphanumeric characters)

It typically appears in variables such as CLICKHOUSE_API_KEY or CLICKHOUSE_KEY_ID, next to a matching secret variable, or in a curl -u command or a Terraform provider block. Do not mix it up with database users: the password of a SQL user on one service is a different credential, covered in the database connection string guide. Only the key ID is recognizable by its shape. The secret half has no fixed prefix, so if the ID leaked, assume the file holding it also holds the secret.

How ClickHouse Cloud API Keys get leaked

  • Infrastructure as code. The provider configuration of a Terraform or Pulumi project with the key ID and secret committed in a variables file.
  • Automation scripts. A script that scales or creates services, with the key written into the call.
  • Environment files. CLICKHOUSE_API_KEY and its secret in a .env or compose file added to a repository.
  • CI pipelines. A deployment job that prints the credentials, or that keeps them in a public pipeline file.
  • Shared commands. A curl -u example pasted into an issue, a ticket or a chat.

What to do in the first hour

  1. Open the API keys list of your ClickHouse Cloud organization (see the link below) and find the exposed key by its ID. Note its role and creation date.
  2. Create a replacement key with the lowest role that your automation needs, and an expiry date if the console offers one.
  3. Deploy the new key and its secret to your pipeline or secret store, and run one harmless call to confirm that it works.
  4. Delete the exposed key. The key list in the organization settings lets you remove it, and the Cloud API has a delete-key endpoint, which refuses to delete the key authenticating that same request. Then retry a call with the old key to confirm it is rejected.
  5. Review your services. Look for services you did not create, changed sizes, new IP access rules, new SQL users or changed settings. Compare with your records or infrastructure code.
  6. Check the activity and billing. Look at the organization activity log if it is available on your plan, and at usage and cost for the period since the exposure.
  7. Rotate what the key could reach. If it could create users or read configuration, change the passwords of the database users on the services. Then clean the code. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same repository? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at ClickHouse

ClickHouse Cloud API keys are managed in the settings of your ClickHouse Cloud organization, after you sign in with a user allowed to administer it. Open the page that lists API keys, select the exposed key and delete it. Deletion is final. A person has not confirmed the exact menu wording for this guide, and the interface can change, so if what you see differs, look for the section where API keys are created and listed, and follow ClickHouse’s documentation.

How LeakWatch detects it

The rule is called ClickHouse Cloud API Key. It recognizes the literal prefix 4b1d followed by exactly 38 letters and digits, with a word boundary on both sides. The prefix is case sensitive: 4B1D does not match. A body that is one character too short or too long is not reported, and neither is a string with more characters attached. It does not need a variable name next to it, so the shape alone triggers it, and because the prefix is short, an unrelated string of the right shape can occasionally match. The severity is critical. This type is not checked live: LeakWatch does not send any request to ClickHouse with the value it found.

LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.

FAQ

Is the key ID alone enough to use the API?

No, the API also needs the secret. But the two are normally stored together, so treat the key as compromised and delete it.

Does deleting the key delete my services?

No. It only removes the key’s access. Your services and their data stay as they are.

Do I need to change the passwords of my databases?

Only if the key’s role could have created users or read their configuration, or if the same file held those passwords. When in doubt, rotate them.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with ClickHouse Cloud.