Repository navigation
Do not run query masking rules over the type of an EPHEMERAL column - #112048
Conversation
The type of an `EPHEMERAL` column is kept as a string, as the argument of
`defaultValueOfTypeName`, and the parser produced that string with
`formatForLogging`. That is the wrong call for the job. It hides secrets - which
a data type does not have - and, more to the point, it runs the server's
`query_masking_rules` over the result, which are meant for what goes into logs
and `system.query_log`, not for a string that has to parse back into the type it
came from.
With the rules the test suite itself configures, which replace
`TOPSECRET.TOPSECRET` with `[hidden]`:
CREATE TABLE t
(
id UInt8,
e Enum8('TOPSECRET.TOPSECRET' = 1, '[hidden]' = 2) EPHEMERAL,
x String DEFAULT toString(e)
)
ENGINE = Memory;
Code: 62. DB::Exception: Duplicate names in enum: '[hidden]' = 1 and 2
Both element names were rewritten to the same thing. Any masking rule that
matches inside a type has the same effect: at best the stored type is not the
one the user wrote, at worst it no longer parses.
The comment on the old call already said the ephemeral column has no secrets and
that this was "the strange call". It now uses `formatWithSecretsOneLine`, the
same one the other places that keep a type as a string use.
|
Workflow [PR], commit [3a5fbbd] Summary: ✅
AI ReviewSummaryThis PR fixes Final Verdict
|
|
Merged
This PR touches only |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 5/5 (100.00%) · Uncovered code |
The type of an
EPHEMERALcolumn is kept as a string, as the argument ofdefaultValueOfTypeName, and the parser produced that string withformatForLogging. That is the wrong call for the job: it hides secrets — which a data type does not have — and it runs the server'squery_masking_rulesover the result. Those rules exist for what goes into logs andsystem.query_log, not for a string that has to parse back into the type it came from.With the masking rules the test suite itself configures (
tests/config/config.d/query_masking_rules.xmlreplacesTOPSECRET.TOPSECRETwith[hidden]):Both element names were rewritten to the same thing. Any masking rule that matches inside a type has the same effect: at best the stored type is not the one the user wrote, at worst it no longer parses.
The comment on the old call already noted that an ephemeral column has no secrets and called it "the strange call". It now uses
formatWithSecretsOneLine, the same call the other places that keep a type as a string already use.Found while working on #111994, which needs the parser not to reach for
formatForLogginghere; it is an independent bug, so it goes on its own.Test
04628_ephemeral_column_type_is_not_maskedfails onmasterwith the error above and passes with this change.Related: #111994
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed the type of an
EPHEMERALcolumn being rewritten by the server'squery_masking_rules. A rule matching inside the type madeCREATE TABLEstore the wrong type, or fail.Documentation entry for user-facing changes
Version info
26.8.1.295(included in26.8and later)