Repository navigation
Conversation
|
Workflow [PR], commit [4210733] Summary: ❌
|
21bc50a to
8ca64c5
Compare
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
|
The MSan stress test failure (MemorySanitizer: use-of-uninitialized-value, STID 4179-5154 or 4148-3044) is a known pre-existing issue unrelated to this PR. Fix: #102158 |
`RestorerFromBackup::getAccessEntitiesToRestore` limits restored grants to what the current user is allowed to grant, documented as "same as `GRANT CURRENT GRANTS`". After making `GRANT CURRENT GRANTS` account for implicit privileges, this restore path was still intersecting with explicit-only grantable rights, so a privilege available only through implicit expansion (e.g. `CREATE VIEW` via `CREATE TABLE`) was silently dropped on `RESTORE ... SETTINGS restore_access_entities_with_current_grants=true`. Use `getAccessRightsWithImplicit` here as well to keep both paths consistent, and add a focused restore test for an implicit privilege. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`04299_restore_access_entities_current_grants_implicit` failed in CI with
`There is no role user_a ... (UNKNOWN_ROLE)` on `SHOW GRANTS FOR user_a`.
The test backs up the whole `system.users` directory and runs `RESTORE ALL`
as a restoring user that had only `CREATE USER` and `CREATE TABLE WITH GRANT
OPTION`. In a populated instance the backup also contains users that have
roles assigned, so `RESTORE ALL` aborts with `ACCESS_DENIED` ("necessary to
have the grant `ROLE ADMIN` ON *.*") before it ever reaches `user_a`, leaving
`user_a` uncreated and the subsequent `SHOW GRANTS` failing with
`UNKNOWN_ROLE`. The minimal instance used during local development happened to
contain no role-bearing users, so the test passed there.
Grant the restoring user `CREATE ROLE` and `ROLE ADMIN` as well, modelled on
the existing `04027_restore_access_entities_with_current_grants` test, so it
can restore every access entity captured by the backup. The implicit-privilege
assertion is unaffected: those extra grants carry no grant option, so they do
not appear in the grantable rights, and `user_a`'s `CREATE VIEW` is still
preserved only through the implicit expansion of `CREATE TABLE WITH GRANT
OPTION`.
CI report: #100703
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
@groeneai check CI issues and link to existing fixes, or create a fix if none exist, even if the failure is unrelated to the current PR. |
|
@vdimir CI triage for HEAD
PR #100703 modifies only Next actions on my side:
|
pufit
left a comment
There was a problem hiding this comment.
@vdimir can you explain why do we need to grant implicit grants explicitly with GRANT CURRENT GRANTS. I'm pretty sure the current behavior is intended and was already changed from getAccessRightsWithImplicit to getAccessRights before
|
@vdimir follow-up on the four failing checks from my prior triage. Status today (2026-06-04):
So the only actionable items left for this PR are the rebase (clears 1 and 2) and pufit's Session: cron:clickhouse-ci-task-worker:20260604-064800 |
|
Merged Rebuilt
The pre-merge CI failures all look unrelated to this access-control change and should be re-evaluated on the fresh CI run:
None touch the access subsystem. |
|
Refreshed the branch: merged current CI: the only failing check is I intentionally did not touch the access-control semantics: the open design question raised by @pufit ( |
DatabaseCatalog::addUUIDMapping(uuid, db, table) threw a LOGICAL_ERROR when
the UUID was already mapped to a live table. During ATTACH DATABASE (and
server startup) tables are loaded via attachTable, which calls addUUIDMapping
directly with a real (database, table) pair and bypasses the empty "lock"
reservation. If two table metadata files in the loaded database declare the
same explicit UUID, the second table reaches that throw and the LOGICAL_ERROR
aborts the whole server in debug/sanitizer builds.
Two table .sql files sharing one UUID is user-controlled, external on-disk
state: it can be produced by manual edits, or by a leftover _tmp_replace_*
table from CREATE OR REPLACE TABLE ... UUID '...' that carries the same
explicit UUID as the live target table. That is a user error, not an internal
invariant violation, and the sibling branch already reports the same condition
as a non-fatal TABLE_ALREADY_EXISTS ("UUID collision, most likely because some
not random UUIDs were manually specified"). The runtime ATTACH TABLE path even
hits that friendly error today; only the load path aborts.
Report the collision as TABLE_ALREADY_EXISTS instead of LOGICAL_ERROR. The
conflicting table fails to load with a clear message, the rest of the database
attaches, and the server stays up. This covers both the ATTACH DATABASE async
load path and the server startup path.
Found by BuzzHouse (amd_tsan) on PR ClickHouse#105020 (STID 3178-4166); the family also
hit PRs ClickHouse#100047, ClickHouse#106268, ClickHouse#100703 (STID 3178-4504). New test
04340_attach_database_duplicate_uuid_no_crash reproduces the crash
deterministically and verifies the server survives.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…T CURRENT GRANTS` Address the review: consulting `getAccessRightsWithImplicit` for the copy-all form `GRANT CURRENT GRANTS ON db.*` (which the parser lowers to `ALL ON db.*`) changed what that form means. Instead of copying the stored grants of the current user, it materialized the whole implicit closure as separate explicit grants on the grantee: a user holding only `CREATE TABLE ... WITH GRANT OPTION` gave the grantee an explicit `CREATE VIEW` that stays behind once `CREATE TABLE` is revoked, plus `SHOW DATABASES`, `SHOW TABLES`, `CREATE TEMPORARY VIEW` and friends. That is a change of the existing semantics, which is why it had to rewrite the expectations of `03215_grant_current_grants` and of six assertions in `test_with_table_engine_grant.py`. `calculateCurrentGrantRightsWithIntersection` now splits the request: privileges named explicitly, e.g. `GRANT CURRENT GRANTS(CREATE VIEW ON db.*)`, are intersected with the implicit rights - this is the case the pull request set out to fix, where the request was silently dropped - while an element asking for everything (`ALL`) keeps being intersected with the stored rights, so the copy-all form copies the grants as they are. The reverted test expectations are back to what they are on `master`, and `04057_grant_current_grants_implicit` gains cases for the copy-all form, for its explicit `CURRENT GRANTS(ALL ON ...)` equivalent, and for the revoke behavior of the grantee afterwards. The `RestorerFromBackup` side is unchanged: there the implicit rights only act as a limiter on the grants stored in the backup, so no derived privilege can be materialized.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 20/21 (95.24%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units8 translation units recompiled, 17 s compile time in total, 8 of them have a recent master baseline. |
|
🕵 @pufit @vdimir, I refreshed this branch to current |
The automated review flagged that `restore_access_entities_with_current_grants` intersects with `getAccessRightsWithImplicit` unconditionally, while the copy-all `GRANT CURRENT GRANTS ON ...` form deliberately stays on the stored rights, and asked to either change the restore side or document and test the broader contract. The restore path is the analogue of the named form, `GRANT CURRENT GRANTS(CREATE VIEW ON db.*)`, not of the copy-all form: the backup already spells out the privileges, so nothing derives the shape of the restored grants from the grants of the restoring user - the restoring user's rights only act as a limit. Limiting by the implicit closure therefore keeps exactly the grants that the restoring user could also have granted by hand, instead of silently dropping them. Document that contract in `RestoreSettings.h` and in the backup/restore documentation, spell it out in a comment at the call site, and cover a second implicit edge in `04299_restore_access_entities_current_grants_implicit`: `SHOW TABLES` restored under a restoring user that holds only `SELECT ... WITH GRANT OPTION`.
|
🕵 @groeneai, investigate the failure: https://github.com/ClickHouse/ClickHouse/actions/runs/31927874656/job/95193430585 ( The job ran 5h00m56s and was killed ( |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
@alexey-milovidov The job was wedged in fuzzer teardown, not in the fuzzer, and it is unrelated to this PR. It is already fixed on master.
The query printed its rows and the command never returned. #115915 (merged 2026-08-22) puts a hard deadline on exactly that line: This job ran on 2026-08-16, six days earlier, so it predates the fix: You found no issue because there was not one. It was tracked and fixed as a PR, merged the day before your comment. No separate PR is needed here. For completeness on the attribution: this PR's diff touches only |
…TS(...)` form The AI review flagged that the public docs for `restore_access_entities_with_current_grants` still claimed "the same semantics as `GRANT CURRENT GRANTS`", while the statement now has two user-visible modes: the copy-all form preserves the grantor's stored grant shape, and the named form is matched against the implicit closure. Restore follows only the named form. Spell that out in the Cloud backup guide, in the `RestoreSettings.h` comment (the source of truth for the setting docs), and describe both modes in `docs/reference/statements/grant.mdx`.
…nts_intersect Merged with an explicit single merge base (`git merge-tree --merge-base`): the branch has two merge bases with master, and the criss-cross recursive merge produced thousands of spurious conflicts in files this pull request does not touch.
The two `tests/queries/0_stateless/__cache__/*.capnp` files are schema files generated by a local test run; they are not part of this change.
| Using the `CURRENT GRANTS` statement allows you to give all specified privileges to the given user or role. | ||
| If none of the privileges were specified, then the given user or role will receive all available privileges for `CURRENT_USER`. | ||
|
|
||
| The statement has two modes, which differ in how the granted privileges are derived from the grantor: |
There was a problem hiding this comment.
This page is inside the AUTOGENERATED_START/AUTOGENERATED_END block, so editing it directly leaves the real source of truth unchanged. The GRANT statement docs are generated from registerStatementGrant() in src/Parsers/Access/ParserGrantQuery.cpp, which still does not contain this new CURRENT GRANTS explanation. As a result the branch fails Docs check (Mintlify), and the next docs regeneration would overwrite these lines.
Please move this text into src/Parsers/Access/ParserGrantQuery.cpp and regenerate docs/reference/statements/grant.mdx, or drop the generated-file hunk and let the docs autogen workflow produce it.
There was a problem hiding this comment.
🕵 Done in 4210733: the paragraph now lives in the registerStatementGrant documentation string in src/Parsers/Access/ParserGrantQuery.cpp, and docs/reference/statements/grant.mdx is reverted to its master version so the autogeneration workflow produces it.
`04299_restore_access_entities_current_grants_implicit` failed in CI with
`There is no role user_a ... (UNKNOWN_ROLE)` on `SHOW GRANTS FOR user_a`.
The test backs up the whole `system.users` directory and runs `RESTORE ALL`
as a restoring user that had only `CREATE USER` and `CREATE TABLE WITH GRANT
OPTION`. In a populated instance the backup also contains users that have
roles assigned, so `RESTORE ALL` aborts with `ACCESS_DENIED` ("necessary to
have the grant `ROLE ADMIN` ON *.*") before it ever reaches `user_a`, leaving
`user_a` uncreated and the subsequent `SHOW GRANTS` failing with
`UNKNOWN_ROLE`. The minimal instance used during local development happened to
contain no role-bearing users, so the test passed there.
Grant the restoring user `CREATE ROLE` and `ROLE ADMIN` as well, modelled on
the existing `04027_restore_access_entities_with_current_grants` test, so it
can restore every access entity captured by the backup. The implicit-privilege
assertion is unaffected: those extra grants carry no grant option, so they do
not appear in the grantable rights, and `user_a`'s `CREATE VIEW` is still
preserved only through the implicit expansion of `CREATE TABLE WITH GRANT
OPTION`.
CI report: ClickHouse#100703
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…he parser doc source The `GRANT` statement page under `docs/reference/statements/grant.mdx` is generated from `registerStatementGrant` in `ParserGrantQuery.cpp`, so the earlier direct edit inside its `AUTOGENERATED` block failed `Docs check (Mintlify)` and would be dropped on the next regeneration. Move the paragraph describing the named form and the copy-all form of `GRANT CURRENT GRANTS` into the parser's documentation string and revert the generated file to its master version. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=100703&sha=1627821104aab625b2cb9b1a6a33645d3e90bcbe&name_0=PR&name_1=Docs%20check%20%28Mintlify%29 PR: #100703 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
🕵 The |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
GRANT CURRENT GRANTSnow correctly considers implicit privileges (e.g.,CREATE TABLEimplicitly includesCREATE VIEW). Previously it silently granted nothing when the privilege was only available through implicit expansion.Documentation entry for user-facing changes
Workflow [PR]
Sync PR [sync-upstream/pr/100703]