Repository navigation
Conversation
…literal
The named-collection parser does not require the key of a `key = value`
override to be a plain literal: `getKeyValueFromASTImpl` evaluates it as a
constant expression. `FunctionSecretArgumentsFinder` works on the AST alone and
reads a key only through `tryGetStringFromArgument`, so an override written with
a computed key is applied by the server and invisible to the masker, and its
value is rendered into `query_for_logging`.
On v26.8.10.6-lts,
CREATE TABLE t (k String, v String)
ENGINE = Redis(creds, concat('pass', 'word') = 'S7') PRIMARY KEY k
is accepted, the table is created, the server authenticates to Redis with `S7`
(measured on the wire: the RESP handshake sends `AUTH S7`, not the collection's
own password), and `S7` is written in cleartext to `system.query_log.query` and
to the server log. The literal spelling `password = 'S7'` of the same override
on the same engine is already hidden, so the guarantee exists and only this
spelling escapes it.
`classifyS3Arguments` and the MySQL TLS keys already hide the value of any
override whose key they cannot read. Give the `Redis` and `ArrowFlight` finders
the same fail-closed scan, and add to `findYTsaurusStorageTableEngineSecretArguments`
the named-collection branch it never had, which is why even a plain readable
`oauth_token = '...'` leaked there. Its positional `markSecretArgument(2)` stays
first and unconditional: master hides that argument whatever argument 0 is, and
`YTsaurus(identifier, ..., 'token')` is rejected only after it has already been
formatted for the log.
Also delete the `return` after the `Redis` finder's readable-key scan: the
parser applies every override in turn, so the first credential found is not a
reason to stop looking, and that `return` would have made the new call dead.
Every edit adds a mark and none is moved, so masking is monotone and the change
cannot un-hide anything. A 61-statement corpus rendered on a master binary and
on this one changes exactly the 14 rows expected and leaves the other 47
byte-identical, including the positional forms, the valid folded positional
`Redis('127.0.0.1:6379', 0 = 1, 'S9', 16)`, a secret in the left operand of an
`equals` at the password slot, and the `s3`/`url`/`mysql`/`mongodb`/`remote`
calls this does not touch.
Not addressed here: a bare positional argument written after a collection name
still shifts the slot the masker hides. Those parsers fold every positional
through `evaluateConstantExpressionOrIdentifierAsLiteral`, so an `equals` is a
legal positional value and no formatter can tell the two shapes apart. The
`mongodb` and `remote` carriers have the same unreadable-key gap and are handled
separately; `ExternalDistributed`'s finder has it too, but that engine was
removed in eac5e98.
Co-Authored-By: Claude Opus 5 <[email protected]>
Condensed the argument-2 masking note in the YTsaurus finder to a one-line invariant.
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex): 2 gate findings plus 6 from my own cold
Also checked, no finding: a census over all 17 functions using Severity: ❌ blocker / Session id: cron:clickhouse-review-self-slot-58:20260922-004700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-self-slot-57:20260922-001900 |
|
Workflow [PR], commit [f33cb5b] Summary: ✅
AI ReviewSummaryThis PR extends the existing fail-closed masking rule for unreadable named-collection override keys to the Missing context / blind spots
Final Verdict✅ No new review findings. LLVM Coverage ReportMeasured on commit f33cb5b.
Changed lines: Changed C/C++ lines covered: 13/13 (100.00%) · Uncovered code |
`CLICKHOUSE_TEST_UNIQUE_NAME` is `${CLICKHOUSE_TEST_NAME}_${CLICKHOUSE_DATABASE}`,
so it is unique per run only while the runner creates a database per test. The
database is pinned whenever `clickhouse-test` is given `--database` (`stress.py`
passes `--database=test_<i>` for every odd worker) and it defaults to `test` when
the script runs outside the runner, and two runs then build the same `query_id`s.
Measured on a pinned database, with the arms of this test neutered so that the
invocation executed no statement at all: the oracle still reproduced its whole
reference output from the previous run's rows and the test reported OK, which is
what would let it certify a leaking binary. With a run-local part in the prefix
the same probe fails with all 20 arm rows missing, while the test still passes
50/50 in the default per-test-database shape.
Reported by clickhouse-gh[bot] on this pull request.
Co-Authored-By: Claude Opus 5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units15 translation units recompiled, 54 s compile time in total, 15 of them have a recent master baseline. |
CI finish ledger - 1c1200aEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
Session id: cron:our-pr-ci-monitor:20260922-073125 |
Algunenano
left a comment
There was a problem hiding this comment.
Superseeded by #122770. One missing case is a7_redis_left_operand, which I'll fix there and add a test
|
I ran my masking corpus (220 statements through -- nc: CREATE NAMED COLLECTION nc AS host = '127.0.0.1', port = 9000, database = 'system', table = 'one', user = 'u', password = 'orig'
CREATE TABLE t (dummy UInt8) ENGINE = Remote(nc, concat('pass', 'word') = 'S7')
-- logged as Remote(nc, concat('pass', 'word') = 'S7'); the literal key gives Remote(nc, password = '[HIDDEN]')
SELECT * FROM remote(password = 'S7', '127.0.0.1:9000', 'system', 'one', 'u')
-- logged as remote(password = 'S7', '[HIDDEN]', '[HIDDEN]', '[HIDDEN]', '[HIDDEN]')The first is a valid table and its override is used: reading it sends |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a credential written in cleartext to
system.query_logand the server log by theRedisandArrowFlighttable engines, thearrowFlighttable function and theYTsaurustable engine: the value of a named-collection override whose key is written as an expression rather than as a plain literal was not masked.Redis(creds, concat('pass', 'word') = 'secret')sets the password, because the parser evaluates the key, but the masker recognized only a literal key; theYTsaurusoauth_tokenoverride was not masked in either spelling.Description
On v26.8.10.6-lts,
CREATE TABLE t (k String, v String) ENGINE = Redis(creds, concat('pass', 'word') = 'S7') PRIMARY KEY kis accepted, authenticates to Redis withS7, and writesS7in cleartext tosystem.query_log.queryand the server log, because the masker recognizes an override key only when it is a plain literal.getKeyValueFromASTImplevaluates an override's key as a constant expression, whileFunctionSecretArgumentsFinderreads it only viatryGetStringFromArgument.classifyS3Argumentsand the MySQL TLS keys already hide the value of any override whose key they cannot read; these three finders did not.findYTsaurusStorageTableEngineSecretArgumentsalso had no named-collection branch at all, and theRedisfinder returned after its first readable hit.This adds that fail-closed scan to the three finders and deletes the early
return. Every edit adds a mark and none is moved, so the change cannot un-hide anything; a 61-statement corpus rendered on a master binary and on this one changes exactly the 14 rows expected and leaves the other 47 byte-identical. The new test carries the credential intosystem.query_logon a master binary and is clean here.A bare positional written after a collection name still shifts the hidden slot, and is not fixed here:
StorageRedisfolds positionals throughevaluateConstantExpressionOrIdentifierAsLiteral, soRedis('127.0.0.1:6379', 0 = 1, 'S9', 16)is a valid table and a formatter cannot separate the two shapes.mongodbandremotehave the same gap and are handled separately.Found while sweeping this file for #121257. The sibling PR #121425 lifts the same
markNamedArgumentsWithUnreadableKeyshelper out offindTLSCredentialsSecretArgumentsbyte for byte and applies it tojdbc/odbc, RabbitMQ and Kafka, so whichever merges second resolves that hunk by keeping one copy.Workflow [PR]
Sync PR [sync-upstream/pr/121467]