[HIDDEN].
What is masked
- The userinfo of a URL (RFC 3986, section 3.2.1):
https://user:password@host/is shown ashttps://[HIDDEN]@host/. The whole userinfo is hidden, because a user name alone can be a token. - The parameters of presigned or signed URLs: AWS S3 (SigV2 and SigV4, such as
X-Amz-Signature,X-Amz-Credential,X-Amz-Security-Token,AWSAccessKeyId,Signature), Google Cloud Storage (X-Goog-*,GoogleAccessId) and Azure SAS (sig). - URL query parameters with a common credential name: a name that contains
secret,password,passwd,token,credential,signatureorkey, or is exactlysig, in any case and percent-decoded. For exampleaccess_token,api_keyandclient_secret. - The secret fields of known connection strings: Azure (
AccountKey,SharedAccessSignature), MongoDB, and the ODBCconnection_string. - The arguments, settings and dictionary source fields that a function, table function, table engine, database engine or dictionary source declares as secret, such as the access keys of
s3, the password ofmysqlor thepasswordof a dictionary source. A secret argument is masked when it is passed directly as a literal.
Where it applies
The same masking applies wherever a credential could be shown:SHOW CREATEand thecreate_table_queryandengine_fullcolumns ofsystem.tables.- The query text in
system.query_log,system.processesand the server log. A URL inside a string literal is masked too. - Error messages: the message returned to the client,
system.query_log.exception,system.errors,system.error_log, thelast_exceptioncolumn ofsystem.dictionariesand the exceptions insystem.kafka_consumers. - Log messages: the server log, the logs sent to the client and
system.text_log, including itsvalue1tovalue10columns. - The output of
EXPLAIN, unless the user can see secrets (see below), and the texts ofsystem.query_log.query_plan. - Other system tables that show a URL, such as
system.schema_inference_cache.
encrypt or a declared secret argument, is also hidden in the error and log messages of that query, if it is 8 bytes or longer.
A user with the displaySecretsInShowAndSelect privilege can see the values in SHOW CREATE and SELECT from system tables when both display_secrets_in_show_and_select and format_display_secrets_in_show_and_select are enabled.
What is not masked
Masking recognizes credentials by where they are, not by what they look like. A credential placed anywhere else is shown as is:- A query parameter whose name is not in the list above, for example
https://example.com/data.csv?Pr1vate=xxx. - A credential in the path of a URL, for example
https://example.com/xxx/data.csv. - A misspelled or unknown argument name of a table function or engine.
- A URL that is not valid under RFC 3986.
- A query that does not parse. Its text is masked only by the URL and connection string rules and by
query_masking_rules. - A value of a query that an error message or
system.query_log.query_planshows transformed, for example encoded, truncated, split or extracted by a function such asextractURLParameter. - A secret argument written as an expression instead of a literal, for example
CAST('...' AS Tuple(UInt64, UInt64))or a value fromWITH. The query text hides the expression, but an error or log message may show a value from inside it. - A credential written to avoid masking, for example a URL with escaped characters such as
'https:\x2f\x2fuser:password@host/', or a URL assembled withconcat. Masking prevents accidental exposure. It does not stop a user who deliberately writes a credential in a form that masking does not recognize.
How to pass credentials
Pass credentials where ClickHouse expects them:- The dedicated arguments of a table function or engine, such as the access key arguments of
s3. - HTTP headers with the
headersargument ofurland theheadersof anHTTPdictionary source, for a service that accepts its token in a header. - Named collections, which keep credentials out of queries entirely.
Custom masking rules
To hide other patterns, such as personal data in query texts and log messages, configurequery_masking_rules in the server configuration.