Repository navigation
Apply query masking to the plan stored in system.query_log.query_plan - #132477
Conversation
Mask every text of the captured plan that can carry user data with `query_masking_rules`, as values, before the JSON document is rendered: step descriptions and details (before they are cut to length), output column names, index and projection descriptions and conditions, string statistics such as join input columns, and the error text. Store no plan for a query in which the plan could show what the `query` column hides in a form masking cannot catch: a query with secret arguments, a query in which a masking rule matches its text or a query parameter of the session, and a query in which a subquery is replaced by its result. The last one is to be lifted once the plan is logged without such values. Related: #123059 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [6c08e0c] Summary: ✅
AI ReviewSummaryThe PR applies Findings❌ Blockers
Tests
Final VerdictStatus: ❌ Block. Close the two remaining masking bypasses and add the focused regressions before treating the logged plan as honoring the advertised masking guarantee. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units1552 translation units recompiled, 2164 s compile time in total, 1552 of them have a recent master baseline. |
Revert the decline of plans for queries in which a subquery is replaced by its result: `log_query_plans` is at an early stage, and the values in the logged plan are to be handled separately. Such a value is still masked like any other text of the plan. The plan stored in `system.query_log.query_plan` no longer names the replicas of distributed index analysis: capture clears the addresses and the logged plan omits `Address`, keeping the per-replica counts. `EXPLAIN` is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
diegomestre2
left a comment
There was a problem hiding this comment.
Looks good to me, I left a few comments that should be checked. Once it is done I can do another round!
# Conflicts: # src/Processors/QueryPlan/Profiling/Capture/CapturedPlan.cpp
|
🕵 Merged |
#132477 added the query text to `QueryPlanLogCapture::canCapturePlan`. The conflict kept the constructor taking `CollectedStatistics` and took master's signature of `canCapturePlan`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Apply
query_masking_rulesand secret hiding to the plan stored insystem.query_log.query_plan, so it is masked like thequerycolumn of the same row.A step renders the literals of the query into the text it describes itself with: filter constants,
INlists, output constants, primary key conditions, and the input columns a join reports in its statistics. These strings are now masked one by one when the plan is captured, before they become values of the JSON document, so the keys and the structure of the document are never touched. The step description and details are masked before they are cut toquery_plan_max_step_description_length, like thequerycolumn, which is masked before it is cut.Some queries store no plan at all, because the plan could show what the
querycolumn hides in a form masking cannot catch:encrypt): in the plan the secret is a constant inside an expression, possibly folded into derived values;lowerof it.The query itself is not affected, and the trace log says why the plan was not stored.
The stored plan also no longer names the replicas of distributed index analysis: it keeps what each replica contributed, without its address.
EXPLAINis unchanged.Related: #123059
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Workflow [PR]
Sync PR [sync-upstream/pr/132477]
Version info
26.12.1.364-master(included in26.12and later)