This skill diagnoses and resolves ClickHouse grant and authentication errors after upgrades, guiding minimal grants and post-upgrade compatibility checks for
npx playbooks add skill altinity/skills --skill altinity-expert-clickhouse-grants
Finds which privilege a blocked operation is missing and computes the smallest grant that unblocks it, from system.errors, system.query_log, system.grants and system.role_grants.
Run altinity-expert-clickhouse-connection first if the connection mode, cluster and time window are not yet established.
checks.sql — 4 checks: access and authentication errors in system.errors over 24 hours (grants-01), missing privileges from queries that failed with exception code 497 (grants-02), current grants for the affected users (grants-03), roles assigned to the affected users (grants-04).reference.md — background (privilege families, access_control_improvements defaults); read only when you need to explain a recommendation.; and start with a -- @check <id> <title> header; keep the id with its result.-- @requires: skip the statement when the named table is missing, when keeper is required and the server has no Keeper/ZooKeeper, or when the version condition is not met. List skipped ids with the reason.{cluster} as written when a cluster macro exists; otherwise apply the connection skill's rewrite rule. Any other {placeholder} is a template variable: substitute a real value first or skip the statement.UNKNOWN_IDENTIFIER, run DESCRIBE TABLE system.<table> and drop the missing column.severity column is the verdict for that row. Copy it; do not re-grade.missing_privileges from grants-02 is the server's own answer. Build the GRANT statements from those values; do not infer the privilege from the query text.db.table over db., and db. over .. A grant that is broader than needed clears the error today and becomes an audit finding later.AUTHENTICATION_FAILED, WRONG_PASSWORD, REQUIRED_PASSWORD) are not privilege problems. Do not propose a GRANT for them; the fix is the user's auth method or host ACL..: SOURCES and its members S3, URL, FILE, REMOTE (plus READ and WRITE on 25.7+); SYSTEM and INTROSPECTION, scoped to the single subcommand.ACCESS MANAGEMENT, WITH GRANT OPTION, displaySecretsInShowAndSelect, NAMED COLLECTION ADMIN, ALLOW SQL SECURITY NONE or IMPERSONATE to fix a routine ACCESS_DENIED. Each one is a privilege-escalation or secret-exposure path and needs explicit justification.access_control_improvements flags select_from_system_db_requires_grant, select_from_information_schema_requires_grant and on_cluster_queries_require_cluster_grant. When these are enabled, users that worked before now need explicit grants on system., INFORMATION_SCHEMA. or CLUSTER, and the error is a behavior change rather than a lost grant.Minimal grants follow this shape. Emit one statement per missing privilege, using the narrowest object and a role when one exists.
GRANT SELECT ON system.processes TO role_analytics;
GRANT role_analytics TO user_x;
check, severity, object, evidence, recommendation; one row per finding, Critical first. Evidence quotes the numbers from the result rows.altinity-expert-clickhouse-securityaltinity-expert-clickhouse-securitysystem.query_log is missing or truncated so failed queries cannot be found → load skill altinity-expert-clickhouse-logsaltinity-expert-clickhouse-replicationWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.