Repository navigation
Check access rights in the TimeSeries table functions - #116629
nikitamikhaylov merged 19 commits into
Conversation
The six table functions that read a TimeSeries table (timeSeriesSamples, timeSeriesTags, timeSeriesMetrics, timeSeriesSelector, prometheusQuery and prometheusQueryRange) did not authorize the TimeSeries table they were pointed at. A user holding only CREATE TEMPORARY TABLE, which every table function requires anyway, could read the column definitions and the rows of a TimeSeries table's target tables and write into them. ITableFunction has one generic authorization seam, checkSourceAccess(), and it is a no-op when getSourceAccessObject() returns nullopt. The three target functions report the target engine from getStorageEngineName() and MergeTree registers no source_access_type; the three siblings report an empty engine name. So no check ran anywhere. Nothing downstream compensates: the planner and InterpreterInsertQuery both skip access checks for table function nodes on the grounds that ITableFunction::execute() has already made them. Each function now requires what the equivalent direct operation requires: the privilege on the TimeSeries table named in the call and, where the function hands back or reads a target table, on that target too. Reading a structure always requires SHOW COLUMNS regardless of the direction of the enclosing query, because a plain DESCRIBE resolves the structure with is_insert_query set. An Alias target is checked through to the table it points at, since its own grant does not cover the metadata it exposes. A row policy on the TimeSeries table cannot be enforced on the rows these functions return, because those rows belong to a target table with different columns, so the read direction fails closed while such a policy exists. The three target functions can no longer back a persistent table. They hand back a pre-existing table that stores data on disk, which StorageTableFunctionProxy cannot proxy: on the first read of the created table it renames the live target table in memory and then violates its own assertions that a table function has no storage policy and stores no data on disk, aborting debug and sanitizer builds on that read and on every later server start that touches the persisted table.
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 6 findings over two full passes of
Two claims of my own in the description were wrong and are corrected: the Prometheus endpoints reach Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20260827-015500 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20260826-235100 |
|
Workflow [PR], commit [84498ac] Summary: ✅
AI ReviewSummaryThis PR closes most of the obvious RBAC gaps around the PR Metadata
Missing context / blind spots
Findings❌ Blockers
Tests
Final VerdictChanges requested. The new guards are directionally correct, but the alias-chain metadata leak and the persisted old-metadata path are still blockers, and the target-function path still over-denies supported external targets whose engines advertise a source-level access type. LLVM Coverage ReportMeasured on commit 84498ac.
Changed lines: Changed C/C++ lines covered: 80/80 (100.00%) · Uncovered code |
|
cc @nikitamikhaylov @pufit, could you review this? The six table functions that read a @nikitamikhaylov, you asked to be assigned: I cannot set assignees or reviewers on this PR myself, both fail for a fork contributor, so please assign yourself. I also left the category as |
| { | ||
| context->checkAccess(access_type, target_table->getStorageID()); | ||
|
|
||
| if (const auto * alias = target_table->as<StorageAlias>(); |
There was a problem hiding this comment.
checkAccessToTimeSeriesTargetTable stops after one Alias hop, but the structure path keeps recursing. With ts -> alias_1 -> alias_2 -> hidden, this helper checks alias_1 and alias_2, then alias_1->getInMemoryMetadataPtr() walks through to hidden without another privilege check, so DESCRIBE timeSeriesSamples(...) / timeSeriesTags(...) / timeSeriesMetrics(...) can still expose the hidden target's schema. This needs a recursive alias resolution check here, or a shared checked-resolution path in StorageAlias.
There was a problem hiding this comment.
Already adjudicated on this PR: row 4 of the adjudication log (#116629 (comment)). I reproduced the chain there and agreed the one-hop check holds only under an invariant nothing maintains.
It is not fixed here because this helper is the same one hop as InterpreterDescribeQuery.cpp:251-257, so DESCRIBE of the alias head discloses the same columns; walking the chain in this one caller would leave that path exposed while reading as fixed. The fix belongs in StorageAlias, and #116153 is where I am pursuing it.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units19 translation units recompiled, 90 s compile time in total, 19 of them have a recent master baseline. |
CI finish ledger - 6f1a686Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
Both stacks terminate in One caveat for anyone reading the CI report page: this head got two concurrent Everything else is green, including all five Session id: cron:our-pr-ci-monitor:20260827-083000 |
The
|
|
@groeneai make the PR green. |
… stress failures)
|
Both reds were the #116128 was reverted in #116909, merged 2026-08-28 15:47 UTC, and CIDB confirms the signature is gone: 0 matching failures since then, against 47,176 Since the fix is a revert on master and not something I can pick up any other way, I merged master at |
CI finish ledger -
|
| Check / test | Reason | Owner / fixing PR |
|---|---|---|
Bugfix validation (functional tests, amd64) |
infra: the job asserts Could not find master builds in S3 (ci/jobs/functional_tests.py:734) and ERRORs before running anything |
a fix task is in progress (fixing PR link to follow here) |
Bugfix validation (functional tests, aarch64) |
same infra assert | a fix task is in progress (fixing PR link to follow here) |
Finish Workflow / Post Hooks |
cascade of the two rows above: new_tests_check.py needs at least one Bugfix validation job to report OK or XFAIL, and both ERRORed |
a fix task is in progress (fixing PR link to follow here) |
Stateless tests (amd_llvm_coverage, old analyzer, s3 storage, DBReplicated, parallel, 1/3) / 03707_autopr_unsupported_cases |
trunk: the autopr positive canaries report 0 0 in the old-analyzer lane (84 unrelated PRs, 109 runs, 12 true-master hits in 14d) |
#117364 (external, merged 2026-08-31 22:05Z), not yet on this branch |
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) / Container memory budget exceeded (/docker) |
host memory over-commit: the /docker cgroup leaf OOM-kills the nested containers and the whole shard loses its signal (244 PRs, 305 runs, 25 true-master hits in 7d) |
a fix task owns it at P1 (fixing PR link to follow here) |
None of these is caused by this PR. #117202 (merged 2026-08-31 11:05Z) is already on this branch and the container-memory signature still fires, so it does not cover it. I am not merging master for #117364 yet: the Bugfix validation infra fix is in review right now, so a single later merge picks up both instead of burning two CI cycles.
Session id: cron:our-pr-ci-monitor:20260901-003000
|
Fixing PR for the |
|
@groeneai merge master and try again. |
|
@groeneai merge master and try one more time. |
The metadata guards this branch adds to StorageTimeSeriesSelector::getConfiguration() check the tags target at table level, while the only thing read from that target there is the type of its id column, and the rows the function returns come from a query it generates which the planner authorizes per column. A reader holding SELECT on the exact tags columns that query needs was therefore refused at parse time, although the read path serves it. The changelog entry already describes the intended split; this makes the code match it. Measured on the fixture of 05045, with a caller holding SELECT, SHOW COLUMNS on the parent and on its samples target, plus GRANT SELECT(id, metric_name, tags, min_time, max_time) on the tags target, that is every column of it individually: pristine master e568d26: DESCRIBE ok, SELECT count() -> 0 this branch b161a70: both refused, SHOW COLUMNS ON <db>.ts_tags with this commit: DESCRIBE ok, SELECT count() -> 0 Revoking one column that generated query reads (min_time) refuses the read again while DESCRIBE keeps working, so authorizing the target stays with that query instead of moving into the guard. A caller granted the target table-wide is unaffected in all three arms. The parent's own guard stays at table level: describing the parent directly needs table-level SHOW COLUMNS, and the read path needs table-level SELECT on it, so that guard refuses nobody this function serves. timeSeriesSamples(), timeSeriesTags() and timeSeriesMetrics() keep their table-level check on the target as well, since they hand back the target itself and cannot restrict its columns. 05045 gains four arms. The first holds the column-scoped caller above. The second covers an inner target, whose resolved identity is all the target check has to work with there, since an inner target has no configured name to authorize before the lookup: with the parent granted and the inner tables not, the three functions over it are refused, and granting the inner tags target its id column describes the selector again. Every other fixture in that file configures external targets, so removing the resolved-target grant check left the suite green before this arm existed. The third gives a tags target an `Alias`, which authorizes the table it points at on that same column: granted the id column on the alias alone the selector is refused, and granting it on the hidden table too describes it. The fourth reads under an always-true row policy, which the read direction is documented to allow: the file covered only a false policy and its absence, so rejecting whenever a policy exists was green there too.
CI finish ledger - d8d650dEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
What did run is green. Session id: cron:our-pr-ci-monitor:20260908-003105 |
… resolving it StorageTimeSeriesSelector::readImpl() authorizes the TimeSeries table on every read, so that a persistent table created with `CREATE TABLE dst AS timeSeriesSelector(db.ts, ...)` is authorized with the reader's own grants rather than with those of whoever created it. It looked that table up before the check, so a reader holding SELECT on `dst` and nothing on `db.ts` was handed the state of `db.ts` instead of the denial: UNKNOWN_TABLE carrying its UUID once it was dropped, TABLE_UUID_MISMATCH naming its current name once it was renamed. Check the configured id first, as StoragePrometheusQuery::readImpl() and StorageTimeSeriesSelector::getConfiguration() already do. The check refuses no read that worked before it. DatabaseCatalog::getTable() returns a table whose database and name match the id it was asked for, or throws, so on every successful read the resolved identity carries the same name as the configured one; the resolved check kept after the lookup covers it as before. Measured on the fixture of 05045 with a caller holding SELECT on the persistent table alone: before, source dropped: 60 UNKNOWN_TABLE, naming the source and its UUID before, source renamed: 741 TABLE_UUID_MISMATCH, naming the source's new name after, both: 497 ACCESS_DENIED, as while the source exists after, caller granted the source: 60 again, unchanged so the change narrows what an unauthorized reader is told without hiding breakage from whoever may see it. 05045 gains the persistent-table lifecycle those arms describe, for both storages: a persistent timeSeriesSelector() and a persistent prometheusQuery() over one TimeSeries table that is then dropped, and a second selector whose TimeSeries table is renamed instead, all read by a caller granted on the persistent tables alone. Removing this commit's check turns the selector's dropped-source arm into UNKNOWN_TABLE and its renamed-source arm into TABLE_UUID_MISMATCH; moving StoragePrometheusQuery::readImpl()'s own check below its lookup turns the prometheusQuery arm into UNKNOWN_TABLE, which nothing covered before. Granting the caller the dropped table then asks for UNKNOWN_TABLE, which fails if such a check ever starts refusing a caller entitled to the table. The renamed-source read is its own statement rather than part of the batch above it, because a client stops at the first statement whose expected error does not match, which would report a regression there as the earlier arm's failure. Two arms are added next to the wrong-engine case for timeSeriesSamples(): the same case for timeSeriesSelector() and prometheusQuery(), whose configured-id checks are separate code and were unpinned, so moving either below its lookup left the file green. One more arm holds the other half of the contract the changelog states, which was unpinned in the same way: the functions that hand a target table back whole check it whole, so a caller holding every column of the samples target individually reads those columns directly and is still refused timeSeriesSamples(). Narrowing that check to a column, as timeSeriesSelector() legitimately does for the one column it reads, hands such a caller the whole target. Co-Authored-By: Claude Opus 5 <[email protected]>
…) read path StorageTimeSeriesSelector::readImpl authorizes both the id a persistent table stores and the identity that id resolves to; StoragePrometheusQuery::readImpl authorized only the stored one. The two disagree once the source table is renamed, because DatabaseCatalog::getTableImpl compares the resolved name to the requested one only when allow_experimental_analyzer is on: with it off, a stale stored id resolves to the renamed table and the read went through. Measured after RENAME TABLE ts TO ts_new against a persistent CREATE TABLE pq AS prometheusQuery(ts, ...), with a reader holding SELECT on pq and on the source under the name pq stores, and nothing on its current name: rows before, ACCESS_DENIED after. A reader granted the current name as well still reads it, and the default analyzer path is unchanged, where the rename gives TABLE_UUID_MISMATCH to every caller including one holding every grant. 05045 does not pin this leg because reaching it needs the old analyzer. Co-Authored-By: Claude Opus 5 <[email protected]>
timeSeriesSamples() hands its target back whole, so a column-scoped grant on that target is not enough for it. Behind an `Alias` target the alias leg carries that rule, and only the direct-target shape had an arm. The caller here holds the alias whole and the table behind it column by column, reads that column through the alias, and is still refused the target. The arm does not attribute the refusal to one check: narrowing the alias leg to a column leaves StorageAlias refusing the same query for its own reasons, so what it pins is the contract rather than a single site. Co-Authored-By: Claude Opus 5 <[email protected]>
…limit This file's runtime is client startup. At 32 client invocations it measured 78.9 to 114.4 seconds under amd_asan_ubsan; the arms added since took it to 63 invocations and 202.3 to 204.1 seconds, past the 180 second limit, which reds the flaky check on every head that runs it. The persistent-table lifecycle and the target-grant arms move to 05137 with a fixture of their own, leaving 34 client invocations here and 31 there. No arm changes: the two files' output, concatenated, is identical to this file's previous reference, and every grant an arm in 05137 needs it now makes itself instead of inheriting one from an earlier arm, so what each one proves is visible where it is written. Co-Authored-By: Claude Opus 5 <[email protected]>
PromQL Compliance ReportBaseline: S3 master
Note: score is unchanged vs baseline. |
|
This is causing issues in stress tests: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=290309210c5b2f0e01c13fd0fbae6577fb5cb9cd&name_0=MasterCI&na=&name_1=Stress+test+%28arm_asan_ubsan%29 Reverting. Please investigate and reintroduce |
|
Reverting was right, and the cause is mine. Root cause, measured: Only stress restarts the server while tests are in flight, which is why only stress sees it. Since the merge it hit 2 of 2 asan legs with an identical signature ( Two things go into the reintroduction. The test must not leave a dangling definition behind. Separately, a persistent table over these functions should not be able to make the server unstartable at all: the eager catalog lookup at parse time predates this PR, so that part looks reachable on plain master ( |
|
Confirmed against the reverted master, as promised: the startup hazard is pre-existing master code, not something this PR introduced.
That is a defect rather than a fact of life: My test is still what triggered it, and dropping the three leftover proxies only shortens the window, since a kill can land inside it. So the fix I would send is both halves: drop the leftovers, and move the catalog lookup out of Two sequencing notes, both yours to decide:
There is a cheaper lever if you prefer it: |
|
Reporting back as promised, now that #119282 is closed. The access-rights half is not mine to re-land: #119282 (comment) says "Checking access rights for TimeSeries needs to be fixed manually, I'll do that". So I am not opening a competing re-land, and I am leaving that half alone. One thing worth knowing for whoever writes that fix, because it is what got this PR reverted rather than anything about the checks themselves: the test added here left three persisted tables defined over The startup defect itself is pre-existing master code, not something this PR introduced: |
|
Here is the separate PR for the startup half, as promised: #119662 It moves the source lookup out of |
`CREATE TABLE p AS timeSeriesData(ts)` was accepted, and then `DROP TABLE ts` dropped `p` instead of the inner samples table and destroyed its rows. On a build with assertions the first read of `p` aborted the server on `!nested_storage->getStoragePolicy()`, from analyzer identifier resolution. `TableFunctionTimeSeriesTarget::executeImpl` returns the TimeSeries table's target table, which is the catalog's own StoragePtr. Persisting a table function wraps its result in a StorageTableFunctionProxy, and that proxy may only hold a storage with no storage policy that stores nothing on disk: it renames the storage in memory to its own id and only then asserts those two properties. An inner target is a MergeTree, so it violates both, and after the rename every StorageTimeSeries path that resolves a target through getTargetTable(...)->getStorageID() - dropInnerTableIfAny, checkTableSizeBelowDropLimit, truncate - resolves to the user's table. Refuse the persistence instead, the way the MergeTree introspection functions and viewIfPermitted already do. The override sits on the class template, so all three instantiations, the timeSeriesData alias and any future ViewTarget::Kind inherit it. The transient form does not go through the proxy and is unaffected. This re-lands the veto that ClickHouse#116629 already merged and that 29d745e reverted for an unrelated reason: that PR's own test left persisted definitions behind over a dropped source, so a stress restart aborted metadata loading. The new test drops every table it creates and asserts that no Proxy row survives. Closes: ClickHouse#119648
Edited by hand following .claude/skills/edit-changelog/SKILL.md, consolidating the nine raw blocks generated between 2026-09-06 and 2026-09-13. The NightlyChangelog job rejected its own edits every night in that period: the verifier did not know that #116566 (reverted by #116586) had itself reverted #109710, so it demanded that no trace of #116586 remain while the rules put its link on the CatBoost entry. Fixed in the job by #119866; this edit passes the patched verifier, and the trailers below give the ledger the missing chain. Failed runs: https://github.com/ClickHouse/ClickHouse/actions/runs/34006912773 through https://github.com/ClickHouse/ClickHouse/actions/runs/34668133756 Changelog-revert: 116566 109710 Revert "Remove CatBoost integration" Changelog-revert: 116586 116566 Revert "Revert "Remove CatBoost integration"" Changelog-revert: 117629 117295 Revert "Skip Darwin fast test in PRs unless labeled ci-macos" Changelog-revert: 118525 118218 Revert "Do not wait for the remote drain when cancelling a remote query" Changelog-revert: 119043 117866 Revert "Add `ci-coverage` label to force LLVM coverage jobs on tests-only PRs" Changelog-revert: 119269 118239 Revert "Require agents to run the style check locally before pushing" Changelog-revert: 119270 115343 Revert "Resume a NATS JetStream subscription after a reconnect" Changelog-revert: 119274 118919 Revert "Carry the mutation version onto a rewritten lightweight `DELETE`" Changelog-revert: 119275 114817 Revert "Convert OUTER join to INNER join by null-rejecting join conditions" Changelog-revert: 119276 110939 Revert "Support real hard links for plain_rewritable metadata." Changelog-revert: 119279 117449 Revert "Print file offsets in the bare fatal stack traces and build the release binary as PIE" Changelog-revert: 119281 116629 Revert "Check access rights in the TimeSeries table functions" Changelog-revert: 119298 118606 Revert "Proper partition pruning with dates" Changelog-revert: 119323 117768 Revert "Docs: Skip private sync for documentation-only pull requests" Changelog-revert: 119334 117356 Revert "Unify the spill trigger for hash joins" Changelog-revert: 119429 114562 Revert "Fix NO_SUCH_COLUMN_IN_TABLE naming a column absent from the table when a part's columns were all renamed or all dropped" Changelog-deleted-entry: 110939 [New Feature] [raw] * Disks with the `plain_rewritable` metadata (`s3_plain_rewritable`, and `azure`/`local` object storages with `metadata_type = plain_rewritable`) support hard links if configured with the new `enable_hard_links` setting, which enables `ALTER` operations and mutations on `MergeTree` tables stored on them. Mutations and partition operations share the unchanged blobs between parts instead of copying them. The setting is off by default, because a disk that has hard links cannot be read by older servers. [#110939](#110939) ([yanglongwei](https://github.com/ylw510)). Changelog-deleted-entry: 114562 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Fixed `NO_SUCH_COLUMN_IN_TABLE` naming a column that is not in the table, when reading or merging a part whose columns had all been renamed or all dropped by a mutation that was not applied yet. The merge kept being retried, so the table stopped compacting. Also fixed the columns of a `MergeTree` part produced by such a merge reading as their default values until the mutation was applied. [#114562](#114562) ([Shaohua Wang](https://github.com/tiandiwonder)). Changelog-deleted-entry: 114817 [Performance Improvement] [raw] * Convert `OUTER JOIN` to `INNER JOIN` when a later JOIN condition filters out its NULL-extended rows, and filter NULL join keys directly at the table scan when column statistics show it is selective. Only conditions of the form `expr1` OP `expr2` are considered, where OP is one of `=`, `<`, `<=`, `>`, `>=`. Each side can be a column or an expression that propagates NULLs. Controlled by the new settings `query_plan_derive_not_null_filters_from_joins` (enabled by default), `query_plan_allow_derived_not_null_filters_execution` (enabled by default) and `query_plan_max_selectivity_for_not_null_filters_execution` (0.7 by default). [#114817](#114817) ([Hechem Selmi](https://github.com/m-selmi)). Changelog-deleted-entry: 115343 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Fixed a `NATS` engine table reading from a JetStream stream (`nats_stream`) silently stopping to consume messages after the NATS server restarted or the connection was re-established. [#115343](#115343) ([Alexey Milovidov](https://github.com/alexey-milovidov)). Changelog-deleted-entry: 116629 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * The table functions reading a `TimeSeries` table (`timeSeriesSamples`, `timeSeriesTags`, `timeSeriesMetrics`, `timeSeriesSelector`, `prometheusQuery`, `prometheusQueryRange`) checked no privilege on it: a user holding only `CREATE TEMPORARY TABLE` could read its target tables' column definitions and rows, and write into them. Each now requires the corresponding privilege on the `TimeSeries` table and on the target table, following an `Alias` target through to the table it points at. `timeSeriesSamples`, `timeSeriesTags` and `timeSeriesMetrics` check the target at table level, since they return it whole and cannot restrict the columns, so a column-scoped grant on the target is not enough; the other three run ordinary target queries, which the planner still checks per column. An external target is authorized before it is looked up, so its existence is not disclosed either. A read fails with `ACCESS_DENIED` when the user's effective `SELECT` row-policy filter on the `TimeSeries` table is not always true, since such a policy cannot be enforced on the target's rows, and the three target functions can no longer back a `CREATE TABLE ... AS` (`BAD_ARGUMENTS`). PromQL over the Prometheus HTTP and remote-read endpoints reaches `timeSeriesSelector` whenever it selects series, so those requests now need these privileges for the user the endpoint authenticated. [#116629](#116629) ([Groene AI](https://github.com/groeneai)). Changelog-deleted-entry: 117356 [Backward Incompatible Change] [raw] * `max_bytes_before_external_join` and `max_bytes_ratio_before_external_join` are now the spill threshold for every hash-based `join_algorithm`, including `grace_hash`, which previously ignored them and spilled on `max_rows_in_join` / `max_bytes_in_join` instead. Those two are a hard cap again for every algorithm: they no longer cause spilling, and a join that spills no longer exceeds them. All join algorithms remain available; `join_algorithm = 'grace_hash'` now needs a non-zero spill threshold, and is skipped in favour of the next algorithm in the list when it has none. Set `legacy_join_size_limits_trigger_spilling = 1` (or `compatibility` to 26.8 or older) to restore the previous behavior. [#117356](#117356) ([Yarik Briukhovetskyi](https://github.com/yariks5s)). Changelog-deleted-entry: 117449 [Build/Testing/Packaging Improvement] [raw] * ClickHouse is now built as a position independent executable on Linux amd64 and aarch64 with glibc, including the release builds, so the text segment is subject to ASLR. Addresses in the bare stack trace of a fatal log are now file offsets relative to the object that contains them, annotated with that object for frames outside the main executable, so they can be resolved with `addr2line -e <object> <hex>` regardless of where the binary was loaded. For the same reason `system.errors.last_error_trace`, `system.error_log.last_error_trace` and `system.crash_log.trace` now store a frame of the main executable as its file offset, keeping runtime addresses for frames in other objects. [#117449](#117449) ([Groene AI](https://github.com/groeneai)). Changelog-deleted-entry: 117768 [NOT FOR CHANGELOG / INSIGNIFICANT] [raw] * Not applicable. [#117768](#117768) ([Dominic Tran](https://github.com/dhtclk)). Changelog-deleted-entry: 118218 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Fixed cancelling a distributed, `s3Cluster` or parallel-replicas `SELECT` taking up to `receive_timeout` (300 s by default) to take effect, and never reaching some of the remote sources, when one of them was draining the packets left over after a `LIMIT` was satisfied. [#118218](#118218) ([Groene AI](https://github.com/groeneai)). Changelog-deleted-entry: 118239 [NOT FOR CHANGELOG / INSIGNIFICANT] [raw] * Require agents to run the style check locally before pushing. [#118239](#118239) ([Nikita Fomichev](https://github.com/fm4v)). Changelog-deleted-entry: 118606 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Proper partition pruning with dates. Closes [#103433](#103433). [#118606](#118606) ([Konstantin Vedernikov](https://github.com/scanhex12)). Changelog-deleted-entry: 118919 [Bug Fix (user-visible misbehavior in an official stable release)] [raw] * Fixed a pending lightweight `DELETE` read with `apply_mutations_on_fly = 1` evaluating its predicate over patch parts created after it, which made rows disappear from the result and reappear after the mutation materialized. [#118919](#118919) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The table functions reading a
TimeSeriestable (timeSeriesSamples,timeSeriesTags,timeSeriesMetrics,timeSeriesSelector,prometheusQuery,prometheusQueryRange) checked no privilege on it: a user holding onlyCREATE TEMPORARY TABLEcould read its target tables' column definitions and rows, and write into them. Each now requires the corresponding privilege on theTimeSeriestable and on the target table, following anAliastarget through to the table it points at.timeSeriesSamples,timeSeriesTagsandtimeSeriesMetricscheck the target at table level, since they return it whole and cannot restrict the columns, so a column-scoped grant on the target is not enough; the other three run ordinary target queries, which the planner still checks per column. An external target is authorized before it is looked up, so its existence is not disclosed either. A read fails withACCESS_DENIEDwhen the user's effectiveSELECTrow-policy filter on theTimeSeriestable is not always true, since such a policy cannot be enforced on the target's rows, and the three target functions can no longer back aCREATE TABLE ... AS(BAD_ARGUMENTS). PromQL over the Prometheus HTTP and remote-read endpoints reachestimeSeriesSelectorwhenever it selects series, so those requests now need these privileges for the user the endpoint authenticated.Description
No public issue; reported privately, fix requested by @ nikitamikhaylov.
Root cause.
ITableFunction's only generic seam,checkSourceAccess, checks the source of the target's engine, not either table, inert unless that engine has one; no planner or insert path checks a table-function node.The change. Three helpers in
StorageTimeSeries.{h,cpp}, called from 13 sites. A structure always costsSHOW COLUMNS: table level where the function returns the target whole, and the one column read (id) intimeSeriesSelector, whose rows its generated query authorizes per column. An external target's configured name is authorized before the catalog is consulted, its resolved identity after, so neither a hidden target nor a rename escapes. The siblings are checked at read time, before theTimeSeriestable is resolved and again on the identity it resolved to, so a persistent table over them is authorized on every read with the reader's grants, disclosing nothing to one with none.Validation. Every guard has an arm that reddens when removed, plus entitled-caller arms catching over-denial. 50/50 green; arms split across 05045 and 05137 for the stateless time limit.
Not fixed here, measured, pre-existing: an inner target's existence stays distinguishable, both it and its derived name reachable directly past the parent check;
timeSeriesSelector's read path and the Prometheus HTTP metadata endpoints resolve their targets before the generated query authorizes them, which no guard anticipates; a reader granted a persistent table's stored source name still learns its new name after a rename, for either storage, hideable only by a denial naming nothing; the source grant a target's engine asks for applies here and not to direct access;describe_include_virtual_columns = 1needsSELECT, the base class's contract; and a table an older server persisted asCREATE TABLE ... AS timeSeriesSamples(...)still loads, since refusing it fails the database load.Workflow [PR]
Sync PR [sync-upstream/pr/116629]
Version info
26.9.1.1126(included in26.9and later)