Repository navigation
Fix RBAC bypass for DESCRIBE/CREATE TABLE AS via table functions - #99122
Merged
alexey-milovidov merged 3 commits intoMar 18, 2026
Merged
alexey-milovidov merged 3 commits into
alexey-milovidov merged 3 commits into
Conversation
Contributor
pufit
force-pushed
the
pufit/fix-describe-table-function-rbac-bypass
branch
from
March 9, 2026 23:08
8f64aa4 to
55a30da
Compare
DESCRIBE TABLE and CREATE TABLE AS on table functions like mysql(), postgresql(), sqlite(), etc. resolved structure without checking source access, leaking schema info and triggering outbound connections (SSRF). Add getActualTableStructureWithAccess() that bundles the source access check with structure resolution. Use it in InterpreterDescribeQuery, InterpreterCreateQuery, and getStructureOfRemoteTable. Remove redundant per-function access checks from url(), s3()/azure(), and file() that were partial (only guarded auto-detection path) and inconsistent (s3/file missed URI-level filtering).
DESCRIBE remote() now requires source access via getActualTableStructureWithAccess in addition to SHOW_COLUMNS.
pufit
force-pushed
the
pufit/fix-describe-table-function-rbac-bypass
branch
from
March 9, 2026 23:09
55a30da to
b2e6cc6
Compare
pufit
marked this pull request as ready for review
March 10, 2026 04:31
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
DESCRIBE TABLE url() with explicit structure now requires READ ON URL. Update test to expect ACCESS_DENIED instead of success.
pufit
force-pushed
the
pufit/fix-describe-table-function-rbac-bypass
branch
from
March 10, 2026 04:37
5b9da69 to
0af5b33
Compare
Contributor
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 98.00% (49/50) |
1 task
robot-ch-test-poll4
added a commit
that referenced
this pull request
Jul 28, 2026
Cherry pick #99122 to 25.8: Fix RBAC bypass for DESCRIBE/CREATE TABLE AS via table functions
robot-clickhouse
added a commit
that referenced
this pull request
Jul 28, 2026
… via table functions
alexey-milovidov
added a commit
that referenced
this pull request
Jul 29, 2026
Backport #99122 to 25.8: Fix RBAC bypass for DESCRIBE/CREATE TABLE AS via table functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix RBAC bypass that allowed users to obtain table structure via
DESCRIBE TABLEorCREATE TABLE ASon table functions (mysql(),postgresql(),sqlite(),arrowFlight(),jdbc(),odbc(), etc.) without the required source access privileges. For functions that infer schema from remote servers, this also allowed triggering outbound connections (SSRF) without authorization.Documentation entry for user-facing changes
No documentation changes needed — this is a security fix that enforces existing access control semantics.
Summary
DESCRIBE TABLE table_function(...)andCREATE TABLE ... AS table_function(...)resolved table structure by callinggetActualTableStructure()without any source access check. The access check (READ ON MYSQL,READ ON SQLITE, etc.) only existed inITableFunction::execute(), which these code paths never called.Affected table functions (SSRF + schema leak on DESCRIBE)
mysql(),postgresql(),arrowFlight(),jdbc(),odbc()— outbound connection without authorizationsqlite()— local file read without authorization (fixes https://github.com/ClickHouse/clickhouse-private/issues/47736)What changed
ITableFunction::getActualTableStructureWithAccess()— bundlescheckSourceAccess()+getActualTableStructure()into a single callInterpreterDescribeQuery,InterpreterCreateQuery, andgetStructureOfRemoteTable(local shard path)url(),s3()/azure()/hdfs(), andfile()— they only guarded thestructure == "auto"path and the s3/file versions were weaker (missing URI-level filtering viacheckAccessWithFilter)Test plan
04028_describe_table_function_rbac_bypass— verifies DESCRIBE and CREATE TABLE AS are denied without source grants, and succeed after grantingNote
High Risk
Touches RBAC enforcement paths for table functions and remote DESCRIBE, which is security-critical and may change behavior for existing users by rejecting previously-allowed queries without proper grants.
Overview
Closes an RBAC bypass where
DESCRIBE TABLE table_function(...),CREATE TABLE ... AS table_function(...), and local-shardremote()structure resolution could fetch/infer table schemas (and potentially trigger outbound connections) without the required source privileges.Introduces centralized access enforcement in
ITableFunctionviacheckSourceAccess()andgetActualTableStructureWithAccess(), updates interpreters and remote-structure helpers to use it, and removes ad-hoc per-table-function checks (e.g.url(), object storage,file()). Tests are updated/added to assertACCESS_DENIEDwithoutREAD ON <SOURCE>grants and to requireREAD ON REMOTEfor remote-describe scenarios.Written by Cursor Bugbot for commit 0af5b33. This will update automatically on new commits. Configure here.
Version info
26.3.1.819(included in26.3and later)25.8.29.37