Repository navigation
MySQL: reject an empty TLS contents override also when the collection stores contents - #113947
Conversation
… stores contents The empty-override rejection in `StorageMySQL::getSSLParams` only ran when the base named collection stored a credential *path*: with the credential stored in the contents form (`ssl_ca_pem` / `ssl_cert_pem` / `ssl_key_pem`), `get_path` returned at the empty-path fast path before looking at `isQueryOverridden`, so a query could pass `ssl_ca_pem = ''` and silently strip the collection-provided CA or client certificate, e.g. disable the verification of the server certificate. The check is now hoisted above the fast path, so an empty contents override is rejected regardless of the form the stored credential has. The same defect in the PostgreSQL counterpart (#110615) was flagged by the AI review there; this is the twin fix for the MySQL surface that had already merged in #112070.
|
Workflow [PR], commit [0c661a5] Summary: ✅
AI ReviewSummaryThis PR fixes the MySQL named-collection TLS override gap where an empty Final Verdict
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 31/33 (93.94%) · Uncovered code |
Build profile diff (arm_release)No arm_release build profile data for commit 0c661a5 - the build was skipped, reused from cache, or predates profile upload. |
… a stored credential The hoisted check was broader than the defect it fixed: it rejected an empty `ssl_*_pem` override even when the collection carried no TLS credential at all, where the override drops nothing and used to be a harmless no-op - and stayed one for the direct arguments. `markQueryOverridden` now remembers the value the collection itself stored for the key (it is called before the override is written), and `StorageMySQL::getSSLParams` consults it through `getValueBeforeQueryOverride`: the empty contents override is rejected only when the collection stores the credential in either form - the path (which a query cannot override, so its key still holds the collection's own value) or the contents (read in its pre-override form). A collection without the credential accepts the no-op override again, consistent with `mysql(..., ssl_ca_pem = '')` without a named collection. Co-Authored-By: Claude Fable 5 <[email protected]>
…de case The overrides of `SOURCE(MYSQL(NAME ...))` reach the collection through the generated-config overload of `tryGetNamedCollectionWithOverrides`, which this change also modified; the regression only exercised the AST overload. The new case overrides the contents-storing collection with `SSL_CA_PEM ''` in a dictionary created with a DDL query and expects the load to be rejected.
|
🕵 Merged
@groeneai, investigate the failures:
and provide a fix in a separate PR (the first one also needs a tracking issue). If a fix is already in progress, link it here. |
|
🕵 Correction on the first failure: it is tracked. The stack trace goes through So both unrelated stress failures have tracking issues with fixes pending elsewhere, and nothing further is needed on this pull request:
@groeneai, no new investigation is needed for the first one — please disregard the tracking-issue request in my previous comment. |
|
Both fixes are in progress, and both are mine:
Both are open and mergeable. Agreed nothing further is needed here, and I am not filing a tracking issue. |
|
🕵 Merged |
|
🕵 Merged |
|
🕵 Merged |
| const bool is_mutable; | ||
| const SourceId source_id; | ||
| Keys query_overridden_keys; | ||
| std::map<Key, String, std::less<>> values_before_query_override; |
There was a problem hiding this comment.
Interesting, why std::less<> is needed to be specified here. But ok.
alexey-milovidov
left a comment
There was a problem hiding this comment.
To be honest, it was not a big concern. Still ok to have.
…stores no credential Port the narrowing from ClickHouse#113947 (MySQL) to `StoragePostgreSQL::getSSLParams`: an empty `ssl*_pem` override is rejected only when it would actually drop a credential the named collection carries - a path (a query cannot override path keys, so the value is the collection's own) or contents, read in the pre-override form via `NamedCollection::getValueBeforeQueryOverride`. On a collection with no TLS keys at all the empty override stays the no-op it is for the direct arguments. Co-Authored-By: Claude Fable 5 <[email protected]>
Related: #112070
Related: #110615
The empty-override rejection in
StorageMySQL::getSSLParamsonly ran when the base named collection stored a credential path: with the credential stored in the contents form (ssl_ca_pem/ssl_cert_pem/ssl_key_pem),get_pathreturned at the empty-path fast path before looking atisQueryOverridden, so a query could passssl_ca_pem = ''and silently strip the collection-provided CA or client certificate — e.g. disable the verification of the server certificate — on every MySQL surface using that collection. The check is now hoisted above the fast path, so an empty contents override is rejected regardless of the form the stored credential has.The same defect in the PostgreSQL counterpart was found by the AI review in #110615, where it is fixed the same way; this is the twin fix for the MySQL surface introduced in #112070. The existing empty-override test gains the contents-storing-collection case.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a defect in the
MySQLintegrations where overriding a TLS credential of a named collection with an emptyssl_ca_pem/ssl_cert_pem/ssl_key_pemvalue was accepted when the collection stored the credential in the contents form, silently dropping the configured CA or client certificate instead of rejecting the override.Version info
26.8.1.1289(included in26.8and later)