Skip to content

Hide secret arguments in EXPLAIN AST like ClickHouse 26.x - #133

Open
kyleconroy wants to merge 1 commit into
claude/project-thread-8e2oya-syntax-5from
claude/project-thread-8e2oya-syntax-6
Open

kyleconroy wants to merge 1 commit into
claude/project-thread-8e2oya-syntax-5from
claude/project-thread-8e2oya-syntax-6

Conversation

@kyleconroy

Copy link
Copy Markdown
Collaborator

Requested by Kyle · project thread

Summary

Since 26.x, EXPLAIN AST hides credentials as '[HIDDEN]'. This PR ports ClickHouse's FunctionSecretArgumentsFinder (and the HideSecretArgumentsMatcher that applies it to the dumped AST) into internal/explain/secrets.go. Pending explain statements drop from 1,694 to 1,200. Stacked on batch 5.

What it masks, following the 26.8 rules:

  • Table functions: s3/gcs/iceberg*/deltaLake*/hudi/paimon* and their *Cluster forms (positional key slots chosen by argument count, NOSIGN/format detection, named secret_access_key/session_token/..., named collections), azureBlobStorage* (account key, connection-string AccountKey/SharedAccessSignature), url/urlCluster, remote/remoteSecure, mysql, postgresql, mongodb, redis, ytsaurus, arrowFlight, jdbc/odbc.
  • Table engines: S3, S3Queue, MySQL, PostgreSQL, MongoDB, URL, AzureBlobStorage/AzureQueue, Redis, Remote, NATS, RabbitMQ, Kafka, JDBC/ODBC and the others in the finder.
  • Functions: encrypt/decrypt/aes_*_mysql/tryDecrypt and HMAC, which keep the expression shape and hide only the literals, plus the sipHash*Keyed keys.
  • Inside values: headers(...) and extra_credentials(...) values, URL userinfo and presigned-URL parameters (http://[HIDDEN]@host, X-Amz-Signature=[HIDDEN]). A table function's SETTINGS clause counts as its last argument, as it does in ClickHouse.

Not covered yet: bigquery, database engines and Backup locators, and EXPLAIN QUERY TREE.

Test Plan

  • go test ./parser/... -timeout 30s passes.
  • Ran go test ./parser/... -check-explain and committed the updated metadata.json files.
  • Compared S3, encrypt and settings edge cases against a local ClickHouse 26.8 server's EXPLAIN AST.

Generated by Claude Code

Port FunctionSecretArgumentsFinder and the EXPLAIN AST masking: credentials
passed to s3/url/remote/mysql/postgresql/mongodb/azure table functions and
engines, encrypt/decrypt/HMAC keys, sipHash keys, headers() and
extra_credentials() values, and userinfo/presigned parameters in URLs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY
@kyleconroy kyleconroy self-assigned this Dec 1, 2026
@kyleconroy
kyleconroy added this pull request to stack #128 December 1, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants