Repository navigation
Hide secret arguments in EXPLAIN AST like ClickHouse 26.x - #133
Open
kyleconroy wants to merge 1 commit into
Open
kyleconroy wants to merge 1 commit into
kyleconroy wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Kyle · project thread
Summary
Since 26.x,
EXPLAIN ASThides credentials as'[HIDDEN]'. This PR ports ClickHouse'sFunctionSecretArgumentsFinder(and theHideSecretArgumentsMatcherthat applies it to the dumped AST) intointernal/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:
s3/gcs/iceberg*/deltaLake*/hudi/paimon*and their*Clusterforms (positional key slots chosen by argument count, NOSIGN/format detection, namedsecret_access_key/session_token/..., named collections),azureBlobStorage*(account key, connection-stringAccountKey/SharedAccessSignature),url/urlCluster,remote/remoteSecure,mysql,postgresql,mongodb,redis,ytsaurus,arrowFlight,jdbc/odbc.S3,S3Queue,MySQL,PostgreSQL,MongoDB,URL,AzureBlobStorage/AzureQueue,Redis,Remote,NATS,RabbitMQ,Kafka,JDBC/ODBCand the others in the finder.encrypt/decrypt/aes_*_mysql/tryDecryptandHMAC, which keep the expression shape and hide only the literals, plus thesipHash*Keyedkeys.headers(...)andextra_credentials(...)values, URL userinfo and presigned-URL parameters (http://[HIDDEN]@host,X-Amz-Signature=[HIDDEN]). A table function'sSETTINGSclause counts as its last argument, as it does in ClickHouse.Not covered yet:
bigquery, database engines andBackuplocators, andEXPLAIN QUERY TREE.Test Plan
go test ./parser/... -timeout 30spasses.go test ./parser/... -check-explainand committed the updatedmetadata.jsonfiles.EXPLAIN AST.Generated by Claude Code