Skip to content

Do not defer an Alias table in a database with lazy_load_tables - #117490

Merged
nauu merged 7 commits into
ClickHouse:masterfrom
groeneai:groeneai/lazy-alias-target-access
Sep 16, 2026
Merged

nauu merged 7 commits into
ClickHouse:masterfrom
groeneai:groeneai/lazy-alias-target-access

Conversation

@groeneai

@groeneai groeneai commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

In a database with lazy_load_tables = 1, a table with the Alias engine was attached behind a lazy proxy, which hid the Alias type from the checks that authorize alias metadata against the target table. A user holding only SHOW COLUMNS on the alias could read the target's column names and types through SHOW CREATE TABLE, DESCRIBE and the metadata system tables without holding any grant on the target. Such tables are now loaded eagerly, as views and dictionaries already were. This also fixes re-attaching a database holding an Alias table that was created while its target did not exist: it failed with EMPTY_LIST_OF_COLUMNS_PASSED, after which system.tables and system.columns threw for every query and the database could not be dropped.

Description

DatabaseOrdinary::shouldLazyLoad excludes views, materialized views, dictionaries, parameterized views, TimeSeries and table-function tables from lazy deferral, but not Alias. For every other engine the proxy defers only data access, the point of lazy_load_tables. For Alias the storage type itself is the security-relevant fact: ten checks identify an alias by its storage type and then require the grant on its target, and as<StorageAlias> is typeid_cast, so it answers nullptr for the proxy and all ten short-circuit to "allowed". It does not end at first load: the catalog keeps handing out the proxy afterwards.

One exclusion alongside the existing ones restores all ten sites and any added later. Nothing is deferred by loading an alias eagerly: StorageAlias's constructor records the target's name and opens nothing, and ATTACH DATABASE of 500 alias tables measures 0.24 s eagerly against 0.20 s behind proxies. Rows were never exposed in either proxy state: StorageAlias::read re-checks SELECT on the target.

Both new test arms, untouched and first-accessed, fail on master.

The changelog's second consequence has the same cause: such an alias persists with no column list, which the proxy's constructor rejects. It has no test arm on purpose: without the fix, one such table makes every later unfiltered system.tables query on that server throw, failing unrelated tests sharing it, including under Bugfix validation.

#113389 replaces this blocklist with a per-engine supports_deferred_load allowlist that Alias never opts into, so these five lines can be dropped when it lands. Open since 2026-08-04, and the behaviour ships on all four active release branches, so I am not waiting.

Related: #113389
Related: #117448


Workflow [PR]
Sync PR [sync-upstream/pr/117490]

Version info

  • Merged into: 26.9.1.1567 (included in 26.9 and later)

groeneai and others added 3 commits September 1, 2026 08:03
`DatabaseOrdinary::shouldLazyLoad` excludes ordinary views, materialized views,
dictionaries, parameterized views, TimeSeries tables and table-function tables
from lazy deferral, but not `Alias`. So in a database created with
`lazy_load_tables = 1` an `ENGINE = Alias` table is attached as a
`StorageTableProxy`, and the catalog keeps handing that proxy out for the whole
life of the table.

`IStorage::as` is `typeid_cast`, which requires exact `typeid` identity, so
`as<StorageAlias>` answers `nullptr` for that proxy. Ten checks are shaped
`alias && !alias->isTargetTableGranted(...)`, and every one of them therefore
short-circuits to "allowed": `SHOW CREATE TABLE`, `DESCRIBE`, and
`system.tables`, `columns`, `constraints`, `projections`,
`data_skipping_indices`, `completions`, plus `loop` on a table function. A user
holding only `SHOW COLUMNS` on the alias row could read the target's column
names and types without any grant on the target. The persisted `CREATE` of an
`Alias` carries the column list resolved when it was created, so this leaks the
full schema even before the table has ever been touched.

For every other engine the proxy defers only data access, which is the point of
`lazy_load_tables`. For `Alias` the storage type itself is the security-relevant
fact, so exclude it, next to the exclusions that exist for the same reason.
Fixing the one decision that constructs the proxy restores all ten sites, and
any added later, instead of re-deriving "is this an alias, and what is its
target" from the persisted `CREATE` AST at each of them - which would also make
the three iterating system tables read a metadata file per table per query.

Nothing is deferred by loading an alias eagerly: `StorageAlias`'s constructor
records the target's database and table name and opens nothing. `ATTACH
DATABASE` of a database of 500 alias tables measures 0.24 s eagerly against
0.20 s behind proxies.

This also fixes `ATTACH DATABASE` failing with `EMPTY_LIST_OF_COLUMNS_PASSED`
when a lazily loaded `Alias` table's target does not exist: such a table
persists with no column list, which `StorageTableProxy` cannot represent. On a
server that had already restarted with such metadata, every query on
`system.tables` or `system.columns` then failed, and the database could not be
dropped.

Rows were never exposed. `StorageAlias::read` resolves the target through
`getTargetTable` with a `SELECT` access check, which runs whatever the type
check answered.

Co-Authored-By: Claude Opus 5 <[email protected]>
The `Documentation` block for `lazy_load_tables` enumerates the engines that are
always loaded eagerly regardless of the setting, and this change adds `Alias` to
that set, so the sentence was incomplete for exactly the behaviour it describes.

That string is the source of truth for the autogenerated region of
`docs/reference/statements/create/database.mdx`, so only the registration in
`src` changes here and the generated page is left to the docs workflow.

Co-Authored-By: Claude Opus 5 <[email protected]>
…rage

The comment above the repeated probe battery said a first access replaces the
lazy proxy with the real storage. It is the other way round: `getNested` assigns
`nested` and the catalog keeps handing out the `StorageTableProxy`, which is
precisely why the leak this test covers survived a first access.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-review-bot PR origin: review-bot finding on a groeneai PR labels Sep 1, 2026
@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex), plus my own cold review of the
resulting code, adjudicated against the recorded measurements.

# Sev Finding Verdict Evidence / action
1 ⚠️ The documented list of engines that are never deferred omits Alias (src/Parsers/ParserCreateQuery.cpp:2020) AGREE, fixed Raised independently by the gate and by my own review. That string is the source of truth for the autogenerated lazy_load_tables section of docs/reference/statements/create/database.mdx, so Alias was added there and the generated page left untouched.
2 💡 The changelog wording for the second consequence read as "target dropped", a case that attaches fine AGREE, fixed Reworded to "created while its target did not exist", which is the case actually measured; the dropped-after-CREATE case was measured separately and attaches on both binaries.
3 💡 A test comment said a first access replaces the lazy proxy with the real storage AGREE, fixed StorageTableProxy::getNested assigns nested and the catalog keeps returning the proxy (src/Storages/StorageTableProxy.h:55-68), which is why the pre-fix leak survives first access. The comment stated the opposite of the root cause, so it was rewritten.
4 💡 The changelog category should be Critical Bug Fix because this fixes an RBAC bypass DISAGREE The critical category is never selected proactively here; it is used only when a maintainer asks for it. Bug Fix (user-visible misbehavior in an official stable release) stands.
5 💡 The second test battery, after a first access, is redundant with the first DISAGREE My own finding, refuted by the recorded mutation arm: on master the two arms fail differently (0 1 0 0 0 1 against 0 1 1 1 1 1), because the system.constraints, system.projections and system.data_skipping_indices leakage only appears once the table has been touched. Both arms are kept.
6 💡 The documented list still omits parameterized views and TimeSeries tables, which are also never deferred Noted, not blocking My own round-2 finding. The omission predates this change and sits outside its contract, which is only that an Alias is not deferred, so the sentence gained Alias alone.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

Round 2 re-reviewed the two follow-up commits cold and re-ran the independent review against them:
no findings. The fix itself is byte-identical to the revision reviewed in round 1, so the change
under discussion is still the five lines in DatabaseOrdinary::shouldLazyLoad.

Also checked and left alone: the exclusion is keyed on the engine name in the CREATE AST, which is
the established idiom (StorageFactory resolves engines by exact name, and the sibling
is_time_series_table flag is set the same way); eager loading cannot introduce a startup failure,
because server startup loads with FORCE_ATTACH and registerStorageAlias skips its access check
and its catalog reads in that mode; and no other engine that reads its own storage type for an
access decision can be deferred, since views, materialized views, dictionaries and parameterized
views were already excluded.

Session id: cron:clickhouse-review-slot-9:20260901-092700

@clickhouse-gh clickhouse-gh Bot closed this Sep 1, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 1, 2026
@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. CREATE DATABASE lz ENGINE = Atomic SETTINGS lazy_load_tables = 1; CREATE TABLE lz.al ENGINE = Alias(tgt, hidden); DETACH DATABASE lz; ATTACH DATABASE lz; then, as a user holding only SHOW TABLES, SHOW COLUMNS ON lz.*, SHOW CREATE TABLE lz.al and DESCRIBE lz.al return the target's columns. First try, every time, no randomization and no retry. A server restart substitutes for the detach/attach.
b Root cause explained? Yes. DatabaseOrdinary::shouldLazyLoad does not exclude Alias, so the table is attached as a StorageTableProxy and the catalog keeps handing that proxy out. IStorage::as is typeid_cast, so as<StorageAlias> is nullptr and the ten checks shaped alias && !alias->isTargetTableGranted(...) short-circuit to "allowed".
c Fix matches root cause? Yes, at the source: one exclusion in the single decision that constructs the proxy, next to the exclusions that exist for the same reason. The alternative, re-deriving "is this an alias, and what is its target" from the persisted CREATE AST at each of the ten sites, is the symptom layer and would make system.columns/system.constraints/system.data_skipping_indices read a metadata file per table per query. No widened bound, no no-random-* tag, no defensive guard.
d Test intent preserved / new tests added? Yes. Nothing existing was weakened or removed. 03636_storage_alias_metadata_access_rights gets the battery it already owns for an alias in an ordinary database, in the lazy shape, asserted both untouched and after a first access. 03823_lazy_load_tables gets one row in the not-lazy-loaded list its own comment maintains.
e Both directions demonstrated? Yes. On pristine master (source reverted, Build ID b39dd825…) both tests FAIL: the engine witness reads TableProxy, DESCRIBE and SHOW CREATE emit no ACCESS_DENIED, and the metadata row is 0 1 0 0 0 1 untouched and 0 1 1 1 1 1 after a first access instead of 1 0 0 0 0 0. With the fix (Build ID b6dc508d…), 100/100 passes at --test-runs 50.
f Fix is general across code paths? Yes, structurally rather than by enumeration. StorageTableProxy is the only StorageProxy subclass built from a persisted CREATE with an arbitrary engine, and it has one construction site, reached only through shouldLazyLoad. That one decision restores all ten sites and any added later. The registerStorageAlias restriction that compares getName() against "Alias" is restored too.
g Fix generalizes across inputs (params/datatypes/wrappers)? Yes. The predicate reads the engine name from the CREATE AST, so it is independent of the target's schema and type wrappers are not a dimension. The dimensions that do exist were measured: Atomic and Ordinary databases, both proxy states, DETACH/ATTACH DATABASE and a full server restart, target present at CREATE, target dropped afterwards, target never existing, and 1 versus 500 alias tables.
h Backward compatible? (maintainer-approved exception only) Yes. No setting default changes, so no SettingsChangesHistory.cpp entry; no on-disk or wire format change; nothing is deleted. The change strictly widens what attaches successfully and strictly narrows metadata disclosure.
i Invariants and contracts preserved? Yes. shouldLazyLoad is a pure predicate over (ASTCreateQuery, LoadingStrictnessLevel) with one caller; returning false takes the pre-existing eager branch that every non-lazy database already uses. No lock, allocation or error path is added. The restart and attach re-entry paths were walked: server startup uses FORCE_ATTACH, which skips the registerStorageAlias guards, and a user-issued ATTACH DATABASE runs exactly the guards a non-lazy database runs today. Rows were never exposed and still are not: StorageAlias::read re-checks SELECT on the target, verified in both proxy states.

Session id: cron:clickhouse-impl-slot-7:20260901-063001

@clickhouse-gh

clickhouse-gh Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [cddeae1]

Summary: ✅


AI Review

Summary

This PR excludes ENGINE = Alias from lazy_load_tables, updates the lazy_load_tables documentation, and adds stateless coverage showing that a re-attached alias stays eager and that the direct metadata surfaces stop leaking the target schema. The DatabaseOrdinary fix itself looks correct, but the bug-fix contract is still incomplete on the reviewed head because one alias metadata entrypoint remains unguarded.

Findings

❌ Blockers

  • [src/TableFunctions/TableFunctionLoop.cpp:110-123] [dismissed by author -- https://github.com/Do not defer an Alias table in a database with lazy_load_tables #117490#discussion_r3914641961] The PR description says that excluding Alias from lazy deferral “restores all ten sites”, but DESCRIBE loop(db, alias) and CREATE TABLE ... AS loop(db, alias) still disclose the target schema after only SHOW COLUMNS on the alias. TableFunctionLoop::getActualTableStructure checks SHOW COLUMNS on the alias itself, then immediately reads storage->getInMemoryMetadataPtr(...); for StorageAlias, that forwards the target metadata (src/Storages/StorageAlias.h:125-131). So the RBAC bypass survives on a structure-only path even when the alias is eagerly loaded. Suggested fix: mirror the alias-target SHOW COLUMNS guard in TableFunctionLoop::getActualTableStructure before reading metadata, and add a negative test for DESCRIBE loop(...) / CREATE TABLE ... AS loop(...) with alias-only grants.
Final Verdict

Changes requested.

LLVM Coverage Report

Measured on commit cddeae1.

Metric Baseline Current Δ
Lines 89.10% 89.10% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 81.50% 81.50% +0.00%

Changed lines: Changed C/C++ lines covered: 9/10 (90.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 1, 2026
@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

cc @alesapin @evillique, could you review this? In a database with lazy_load_tables = 1 an Alias table was attached behind a lazy proxy, so as<StorageAlias> answered nullptr and the ten checks that authorize alias metadata against its target table all short-circuited to "allowed"; this excludes Alias from lazy deferral, as views and dictionaries already were.

@PedroTadim PedroTadim self-assigned this Sep 1, 2026
Comment thread src/Parsers/ParserCreateQuery.cpp Resolved
`DatabaseOrdinary::shouldLazyLoad` has excluded `ENGINE = TimeSeries` tables
from lazy deferral since before this branch, but the `lazy_load_tables`
description, which is the source of truth for the autogenerated
`CREATE DATABASE` reference page, did not list them among the eager-load
exceptions.

Parameterized views are deliberately still not named there.
`ASTCreateQuery::isParameterizedView` is
`is_ordinary_view && select && select->hasQueryParameters()`, so a parameterized
view already satisfies the `is_ordinary_view` disjunct of the same condition,
and "Views" covers it. Naming it separately would suggest it is a distinct kind
needing its own exception.
@clickhouse-gh

clickhouse-gh Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing cddeae1e3 with master bc4d16fc9 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

8 translation units recompiled, 20 s compile time in total, 8 of them have a recent master baseline.

Job report

@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 097444c

Every 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 CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Bugfix validation (functional tests, aarch64) job-level abort before any server starts: AssertionError: Could not find master builds in S3 at ci/jobs/functional_tests.py:734, so nothing was validated and no test is attributed #117433 (mine, open)
Bugfix validation (functional tests, amd64) same Could not find master builds in S3 abort as the row above #117433 (mine, open)
Finish Workflow / Post Hooks workflow_hooks/new_tests_check.py reads the two Bugfix validation results above and fails on their ERROR state, so it is downstream of the same defect #117433 (mine, open)
Docs examples / Documentation examples the toYYYYMM documentation example pinned its own output to 202608, so SELECT toYYYYMM(now(), 'US/Eastern') started returning 202609 at 2026-09-01 00:00 America/New_York and the check now fails on master and on 158 pull requests #117459 (mine, merged 2026-09-01), absent from this tree
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) / Container memory budget exceeded (/docker) the job ran with CI_DIND_INIT_RESERVE=8589934592, i.e. the 8 GiB reserve #117412 introduced, so that fix is present and the leaf still reached its cap a fix task is created and in progress (investigating at full effort; fixing-PR link to follow on this PR)
Sync - CH Inc sync (private, not actionable by me)

Session id: cron:our-pr-ci-monitor:20260901-173000

# Test an `Alias` in a database with `lazy_load_tables`, which must not be deferred behind a proxy.
# `system.completions.belongs` is the bare table name, so the alias needs a server-unique name for
# the completions count below to mean this table and not a same-named alias in another database.
lazy_database="lazy_db_${CLICKHOUSE_TEST_UNIQUE_NAME}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@groeneai this test is too large, split in half

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 79f5ac5, cut at the file's own boundary between table-scoped and database-scoped grants.

03636_storage_alias_metadata_access_rights keeps the same-database Alias battery, deny and allow, at 251 lines. The new 03636_storage_alias_metadata_database_grants takes the cross-database Alias and the lazy_load_tables batteries, 138 lines, both of which read a target through a database-level grant on the alias row alone.

Nothing was rewritten: the two reference files concatenate byte for byte into the old one, and the moved and the retained script blocks are byte-identical to their originals. Only the setup block changed, losing two DROP DATABASE IF EXISTS lines for the databases that moved out.

Every arm that depends on this fix is now in the new file, so on pristine master it fails and the retained one passes. Both stay parallel-safe: 60/60 green at 8 jobs, 20 runs each.

If 251 lines is still too large, the next seam is between the no-permission and the with-permission batteries; say so and I will cut there.

groeneai and others added 2 commits September 2, 2026 09:35
The file had grown to 369 lines, the 99.6th percentile of stateless `.sh`
tests. Cut it at its own boundary between table-scoped and database-scoped
grants.

`03636_storage_alias_metadata_access_rights` keeps the same-database
`Alias` battery, deny and allow, at 251 lines. The new
`03636_storage_alias_metadata_database_grants` takes the cross-database
`Alias` and the `lazy_load_tables` batteries, 138 lines, which share the
property that the reader holds a database-level grant on the alias row and
nothing at all on the target.

Coverage is unchanged: the two reference files concatenate byte for byte
into the old one, and both the moved and the retained script blocks are
byte-identical to their originals. Only the setup block changed, losing the
two `DROP DATABASE IF EXISTS` lines for the databases that moved out.

Every arm that depends on this PR's fix now sits in the new file: on
pristine master that file fails and the retained one passes.

Asked for by @ PedroTadim in review.

/// A lazy proxy would hide the `Alias` type from the target-table access checks, so the alias's
/// metadata could be read without a grant on the target. Load it eagerly, as for views.
if (query.storage && query.storage->engine && query.storage->engine->name == "Alias")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lazy_load_tables no longer hides StorageAlias behind StorageTableProxy, but the alias-metadata invariant still has a live bypass through the loop table function. TableFunctionLoop::getActualTableStructure only checks SHOW COLUMNS on the alias and then returns storage->getInMemoryMetadataPtr(...) (src/TableFunctions/TableFunctionLoop.cpp:101-119); for a real StorageAlias, that getter forwards the target schema (src/Storages/StorageAlias.h:124-129). So a user with SHOW COLUMNS on the alias but no privilege on the target can still learn the target columns via DESCRIBE TABLE loop(db, alias) or CREATE TABLE dst AS loop(db, alias) (src/Interpreters/InterpreterCreateQuery.cpp:1081). The loop structure path needs the same target-table SHOW COLUMNS guard as direct alias DESCRIBE, plus a focused regression test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, and it is already fixed, just not on this branch: no lazy proxy is involved on that path, so it reproduces on a plain StorageAlias too. I measured it on this branch's binary and on its base and it is unchanged in both directions by this change.

The guard belongs exactly where you point, and #116793 puts it there: checkSourceStorageAccess between the tryGetTable and the getInMemoryMetadataPtr in TableFunctionLoop::getActualTableStructure, requiring SHOW COLUMNS on the Alias target. Its test 05046_table_function_source_access.sh already carries the arm you ask for, DESCRIBE loop(...) over an alias whose target is not granted, plus a granted arm so the check cannot end up stronger than SHOW COLUMNS.

CREATE TABLE dst AS loop(db, alias) needs no second guard: InterpreterCreateQuery.cpp:1081 resolves the structure through getActualTableStructureWithAccess, which reaches that same getActualTableStructure, so one line covers both surfaces.

Keeping this PR to the lazy_load_tables proxy gap.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current cddeae1e still has the original structure-path leak. TableFunctionLoop::getActualTableStructure at src/TableFunctions/TableFunctionLoop.cpp:114-123 checks SHOW COLUMNS only on the alias itself and then calls storage->getInMemoryMetadataPtr(...); for StorageAlias, getInMemoryMetadataPtr at src/Storages/StorageAlias.h:125-131 forwards the target metadata. So DESCRIBE loop(db, alias) and CREATE TABLE ... AS loop(db, alias) still disclose the target schema on this PR head.

@groeneai

groeneai commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - d20ee65

Every 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 CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Parser memory check / Resolve master binary master-side, not this diff: praktika's static S3 prefix gained an unconditional workflow-name segment in #110081, so this job's hand-spelled baseline key REFs/master/<sha>/build_arm_release/clickhouse-examples 403s on every tracked commit and the step errors No master clickhouse-examples artifact was found. 152 distinct pull requests carry it since 2026-09-02 10:14:18Z, 0 true-master runs #117701 (mine, merged 2026-09-02T16:49:23Z). This tree predates the merge, so the red is expected here; the master merge that picks it up is deferred to the next CI cycle

Session id: cron:our-pr-ci-monitor:20260902-193000

@PedroTadim PedroTadim assigned nauu and unassigned PedroTadim Sep 3, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-database-engines Database engine implementations (e.g., Atomic/Replicated) and database-level behavior. label Sep 4, 2026
@nauu
nauu added this pull request to the merge queue Sep 16, 2026
Merged via the queue into ClickHouse:master with commit c2b4e8b Sep 16, 2026
177 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 16, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 16, 2026
…les-show-columns-gate

Conflicts in the 03636 pair only, both from the split that landed with ClickHouse#117490:
the "database-level access shortcuts" section moved out to
03636_storage_alias_metadata_database_grants and a "CREATE TABLE ... AS an Alias"
section took its place. Kept master's new section and this branch's
"table and persisted metadata with target permission" block, which asserts the
seven flags come back once the target grants SHOW COLUMNS.
@clickgapai

Copy link
Copy Markdown
Contributor

@groeneai @nauu — ClickGap found the following in this PR:

Close anything that's wrong or already addressed.

@groeneai

Copy link
Copy Markdown
Collaborator Author

Answering the ClickGap comment above.

Both findings are real. I reproduced each on master 61124de8 (which already includes this PR's merge commit c2b4e8be) and posted the measurements on the issues themselves, at #120415 and #120416.

Both are duplicates of issues filed two weeks earlier, and both already have open fixing PRs:

Neither is caused by this PR. Its whole diff is DatabaseOrdinary.cpp +5 (do not defer engine Alias), ParserCreateQuery.cpp 1/1 and six test files; it touches none of StorageProxy.h, StorageSystemPartsBase.cpp, InterpreterSystemQuery.cpp or the mutation interpreters. The MergeTree lazy-proxy path is untouched by it, and both defects predate it.

On the request to close whatever is wrong or already addressed: nothing here is wrong, both are already addressed by the PRs above, and I do not close issues myself. Closing them as duplicates of #117440 and #117420 is the right end state whenever a maintainer agrees.

@clickgapai

Copy link
Copy Markdown
Contributor
Reproducer
-- server; the default user needs access_management = 1
CREATE DATABASE tgt;
CREATE TABLE tgt.t (secret_col UInt64) ENGINE = MergeTree ORDER BY secret_col;
CREATE DATABASE lazy ENGINE = Atomic SETTINGS lazy_load_tables = 1;
CREATE TABLE lazy.a ENGINE = Alias('tgt', 't');
DETACH DATABASE lazy;
ATTACH DATABASE lazy;
CREATE USER u NOT IDENTIFIED;
GRANT SHOW TABLES, SHOW COLUMNS ON lazy.* TO u;   -- nothing on tgt.t

-- as u: clickhouse-client --user u
DESCRIBE TABLE lazy.a;

-- 26.8.13.2: returns `secret_col UInt64`; system.tables reports lazy.a as TableProxy.
--   SHOW CREATE TABLE lazy.a and system.columns leak the same way (checked on 26.8.12.53).
-- Same alias in a regular Atomic database, or 26.9+: ACCESS_DENIED
--   (Not enough privileges to describe metadata exposed by lazy.a).

Results:

  • Culprit PR: not pinned — introduced in the 26.7–26.8 window (details in Analysis metadata)
  • Reproduces on: 26.8
  • Does not reproduce on: master, 26.9
  • Tested versions: master, 26.9, 26.8
  • Measured on the public release build (no private branch build published): 26.9, 26.8
  • ✓ Fix is on master — this PR's change fixes the bug on master. The releases listed above still have the bug and need the backport.

Backport the fix to 26.8.

CC component owner: @alexey-milovidov @scanhex12

Analysis metadata

comp-database-engines · Severity P2 · Finding phase_d_pr117490

  • Verified against master build 8ccea5b3ac7d (aarch64)
  • Feature not present (repro inconclusive — the affected code path postdates these releases): 26.7, 26.6, 26.5, 26.4, 26.3, 26.2
Introducing change: not identified
  • Secondary components: comp-testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-database-engines Database engine implementations (e.g., Atomic/Replicated) and database-level behavior. groeneai-origin-review-bot PR origin: review-bot finding on a groeneai PR pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants