Support ClickHouse EXECUTE AS <user> for Proper RBAC and Auditability #1514
shahparthiv
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
The current Grafana ClickHouse datasource allows configuring only one ClickHouse user at the data source level.
As a result:
This creates major limitations in:
New ClickHouse Feature: EXECUTE AS (introduced in ClickHouse 25.11)
ClickHouse 25.11 introduced the ability for one user to run a query on behalf of another user, inheriting the target user’s:
This is enabled by granting impersonation rights:
And used as:
This new capability solves the RBAC and auditing problem perfectly for applications that authenticate with a single technical user, but need queries to be executed on behalf of real application users.
Proposed Enhancement for Grafana ClickHouse Plugin
I would like to request support for an optional setting in the datasource configuration that enables query impersonation using EXECUTE AS.
How it would work
Enable Impersonation (Data Source Setting)
Add a toggle such as:
If enabled, the plugin should wrap outgoing queries with:
For all dashboard panels:
Alerts are tricky because they do not execute in a user session.
Proposal:
This provides per‑user RBAC and auditability even for alerts that run in the background.
Benefits
✔️ Full RBAC enforcement
Queries inherit access controls of each individual user.
✔️ Proper auditing
ClickHouse logs show which user actually executed each query.
✔️ Least privilege principle
Datasource can be configured with a technical user that has minimal rights + impersonation ability.
✔️ No need to create a datasource per user
Users remain fully isolated while sharing a single datasource configuration.
✔️ Better compliance
Helps organizations meet audit requirements in regulated environments.
Request
I would like to propose adding support for this feature in the Grafana ClickHouse Datasource plugin. I am happy to contribute as well.
Beta Was this translation helpful? Give feedback.
All reactions