Repository navigation
Hide the arguments of a table function or function with secrets called with the wrong letter case - #124862
Conversation
…on with secrets `SecretArgumentsRegistry::find` looks an ordinary function up in `TableFunctionFactory` and `FunctionFactory` under each factory's own case rule. A call such as `SELECT * FROM S3(...)` (the engine spelling in a table-function position), `MySQL(...)` or `ENCRYPT(...)` finds no spec, so nothing is hidden: `executeQuery` writes the statement, credentials included, to the server log and `system.query_log` before the factory rejects the name with UNKNOWN_FUNCTION. ClickHouse#123364 made an unregistered engine fail closed; this is the converse direction. When the name equals, ignoring case, a table function or function whose spec has argument secrets, and is not itself a registered function, `find` now takes the existing fail-closed path and hides every argument. Every other unknown function keeps its arguments visible, so UDF calls are unaffected unless the UDF is named like such a function up to case. `TableFunctionFactory` records the lowercase names with argument secrets at registration; `FunctionFactory` scans its six secret specs. The cost per spec-less function is one lowercase copy, one hash lookup and that scan, below run-to-run noise when formatting a 50,000-call query. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the fail-closed rationale from the ORDINARY_FUNCTION branch comment; the comment at maskEveryArgument already states it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding; one full pass).
Severity: ❌ blocker / Session id: cron:clickhouse-review-self-slot-58:20261009-082700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-self-slot-57:20261009-071500 |
|
Workflow [PR], commit [e1c170b] Summary: ✅
AI ReviewSummaryThe PR hides every argument of otherwise unregistered calls whose names differ only in case from secret-bearing functions or table functions. No actionable findings in the current diff. The focused regression test covers formatter output and Missing context / blind spots
Final VerdictStatus: ✅ Approve. |
Algunenano
left a comment
There was a problem hiding this comment.
Changes look good, but this should not be considered a bugfix. It's an improvement to help keep things tidy on a known bad case, but I don't think it's realistic to expect us to handle every possible syntax error
|
Thanks, agreed. I changed the changelog category to Improvement and rewrote the changelog entry accordingly. |
Build profile diff (arm_release)Commit See the job log for details. |
CI finish ledger - 0376a14Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261009-140011 |
|
Fixing PR for |
|
Fixing PR for 03254_system_prewarm_mark_cache (ParallelReplicas) created: #124942 |
In the ParallelReplicas configuration the single segment of these tests' tables is read by whichever of the three replicas gets it. When a remote replica reads it, the mark and primary index load counters land on that replica's own query_log row (is_initial_query = 0, current_database = 'default'), which the current_database = currentDatabase() filter drops, so the initiator row shows 0. parallel_replicas_local_plan = 1 does not help: the local plan is used but gets nothing to read. Sum the counters over all rows whose initial_query_id is one of the test's queries, as in 02417_load_marks_async (ClickHouse#123825). All replicas share one server's caches and each load is counted once, so the exact references are unchanged, and nothing changes without parallel replicas. Failing job: 03254_system_prewarm_mark_cache in Stateless tests (arm_binary, ParallelReplicas, s3 storage, sequential) on PR ClickHouse#124862. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The arguments of a table function or function with secrets are now hidden in
system.query_logand the server log also when the call uses the wrong letter case, such asS3(...)instead ofs3(...),MySQL(...)instead ofmysql(...), orENCRYPT(...). Such a call is still rejected.Description
On 26.8.18.2,
SELECT * FROM S3('https://b.s3.amazonaws.com/k', 'AKID', 'secret', 'CSV')is rejected withUnknown table function S3. Maybe you meant: ['s3'], but only after the statement, secret included, was written tosystem.query_logand the server log. The same holds forMySQL,URL,REMOTE,PostgreSQL,AzureBlobStorage,IcebergS3,INSERT INTO TABLE FUNCTION S3(...),CREATE TABLE ... AS S3(...)andENCRYPT/Decrypt: the engine spelling in a table-function position is the natural mistake.SecretArgumentsRegistry::findlooks an ordinary function up inTableFunctionFactoryandFunctionFactoryunder each factory's own case rule. A wrong-case name finds no spec, so nothing is hidden andexecuteQuerylogs the raw text before the factory rejects the name. #123364 already fails closed for an unregistered engine; this is the converse direction.Now, when the name equals, ignoring case, a table function or function whose spec has argument secrets, and is not itself a registered function,
findtakes the existing fail-closed path and hides every argument. Any other unknown function stays visible.TableFunctionFactorykeeps the lowercase names with secrets at registration;FunctionFactoryscans its six secret specs.The new test
05340_wrong_case_function_name_hides_secretschecksclickhouse-formatand thequery_logrow. It fails on master 895d8b8 (the secrets are printed) and passes with the fix. No registered function equals a secret table function up to case.Not covered: wrong-case argument names inside a correctly spelled call (
s3(..., SECRET_ACCESS_KEY = '...')) and arbitrary misspellings, the typo family left toquery_masking_rules. A SQL UDF named like such a function up to case (CREATE FUNCTION S3 ...) gets its logged arguments hidden; its result is unchanged.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124862]
Version info
26.10.1.2474-master(included in26.10and later)