Repository navigation
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Queue requested — the merge queue status continues in this comment ↓. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 8e010d79ec2e098b11a741051b10347ba84cf52e
Assessment: request_changes
The backport fixes ordinary table-only SHOW access and refreshes prepared subscription metadata. It reuses the upstream visibility rules, but the new admission path lets user-supplied SHOW predicates bypass table authorization. SHOW TABLES also needs to carry its admission decision into planning and preserve access for users already authorized at database scope.
Model: gpt-6.2-sol / xhigh
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
-
P1
pkg/frontend/authenticate.go:8689: A user with only a table-level grant runs SHOW TABLES or SHOW COLUMNS with a WHERE predicate that reads another table through a subquery.
Impact: The new fallback admits the SHOW, and the presence or absence of returned metadata rows can disclose information from a table the user cannot query directly.
Evidence: The parser accepts a general WHERE expression.pkg/sql/plan/build_show.go:1144attaches it to the generated SELECT, andpkg/sql/plan/query_builder.go:6806binds its subqueries. The plan authorization check atpkg/frontend/authenticate.go:9105returns early because SHOW is database-scoped. The backport makes this gap reachable by table-only users. Authorize reads introduced by the user's predicate separately from the generated catalog reads, or reject predicates that introduce such reads. -
P2
pkg/sql/plan/build_show.go:340: An operator lowers the advertised protocol on the same CN after object-only SHOW TABLES admission and before that statement is planned.
Impact: The statement can use the protocol 11 listing without satisfying the protocol 11 database privilege gate, exposing names of ungranted sibling tables.
Evidence: Frontend admission reads the mutable protocol atpkg/frontend/show_metadata_privilege.go:88, and planning reads it again to decide whether to add the visibility filter. The existing query service can update that runtime value in place. Carry the admission decision into planning and fail closed if an object-admitted statement cannot use the filtered plan. -
P2
pkg/sql/colexec/table_function/current_roles.go:165: A user already authorized by a database-level SHOW grant runs a local SHOW TABLES with more than 4,096 active or inherited roles.
Impact: A listing that succeeds on the released branch fails with a role-closure limit error, even when the primary role alone grants access to the whole database.
Evidence: The existing database privilege checker can return as soon as the primary role grants access atpkg/frontend/authenticate.go:8257. The new planner still installs the visibility CTE for every eligible local listing, which forces complete role traversal and raises the new limit error. Preserve the database-authorized route while retaining bounded role resolution for object-only visibility.
Validation:
-
Verified the frozen head, merge base, clean checkout, and 52-file delta. Compared the upstream fix and the released v4.2.8 and hotfix source. Recorded all three discussion entries.
-
Isolation preflight and the native prerequisite build passed. Focused tests passed across frontend, planner, compiler, table functions, process and pipeline codecs, and sysview. Additional retry, compiler-pool reuse, and subscription-view checks passed. Commands, exits, source fingerprints, and log hashes are recorded in
validation-reconciliation.json. -
The frozen CI snapshot records successful shared build, unit, static-analysis, and multi-CN BVT checks.
Limitations:
- The findings are based on source tracing. The local runs exercised the committed regression tests and lifecycle controls. Release-binary upgrade, full BVT, and repeated race runs were not independently repeated.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 8e9a5a47468411168bbe496ffb7015764ffb24c1
Assessment: approve
The backport binds SHOW admission and metadata reads to the same authorized target and statement snapshot. Prepared execution refreshes admission while preserving the user's transaction snapshot. The final repair preserves terminal pipeline errors through cleanup and unblocks sibling pipelines and shared role loaders. The prior findings are resolved on this head.
Model: gpt-6.2-sol / xhigh
Session: 01a1eecd-3287-70c0-bb93-ab923faf5f3f · slot 0 · generation 2
Validation:
-
Passed 36 focused race tests across five packages, the full short table-function race suite, and the authenticated MySQL regression in both RC and SI.
-
The short compiler race suite reported three Parquet fanout failures. All three reproduced with the same assertion failures on the pinned merge base under the same test configuration.
-
Verified the clean frozen source, native input provenance, additive pipeline descriptor change, and protocol 11 release and hotfix boundary. Reconciled logs and receipts in validation-reconciliation.json and accounted for all 15 discussion entries.
Limitations:
- Release-binary upgrades, forced-placement multi-CN SQL, and latency were not independently measured.
❌ Left the queue ·
|
Backport the SHOW metadata behavior from matrixorigin#30304 onto the release branch. Bind the selected database, evaluate current object grants at execution time, and preserve publication allowlists and view definition privileges. Use release protocol 12 for object-only SHOW TABLES admission and row filtering. Protocol 11 retains its database-level admission and listing. Propagate the active role identity and transaction context and bound role closure loads per physical execution, including retry and cancellation. Refs matrixorigin#32855.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: e30e171b280d3616918e880dbc21f0c714b0c3f4
Assessment: approve
The backport binds SHOW authorization and metadata reads to the same target and statement snapshot. Prepared execution refreshes authorization while preserving the user’s transaction snapshot. The latest change classifies recovered pipeline errors before cleanup, preserving terminal failures and allowing graceful local stops.
Model: gpt-6.2-sol / xhigh
Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3
Validation:
-
Verified the frozen diff, native build inputs, isolation preflight, and additive pipeline descriptor change. Confirmed protocol 11 on v4.2.8 and the cited hotfix revisions, and protocol 12 on the candidate.
-
Focused race checks passed, including authenticated SHOW in read committed and snapshot isolation. Three cancellation checks each passed 100 race repetitions, including the recovered-reader probe.
-
The full table-function race suite and the pipeline and sysview package tests passed.
-
Reconciled all 18 discussion entries and recorded the receipts and logs in validation-reconciliation.json.
Limitations:
-
The full compiler race suite failed three Parquet planning assertions. The same assertions failed on the earlier release base, and the affected test files and planning implementation match across the rebase.
-
The frozen evidence contains no terminal CI result for this head. Release-binary upgrades, forced multi-CN SQL placement, and latency were not independently measured.
Independent QA challenge validationValidated the current head Scope: custom black-box SQL probes, custom white-box probes, base/head differential checks, concurrent GRANT/REVOKE, and focused latency measurements. No existing unit tests or BVT suites were run. ResultNo reproducible privilege escalation, denied-object metadata leak, stale prepared authorization, or cancellation/cache lifecycle failure was observed in the covered cases. The main item worth follow-up is the cost of deep role-inheritance chains. 1. Base/head correctness differentialUsing a three-level inherited role chain
This confirms that the custom witness fails on the base and exercises the intended fix on the head. Negative and boundary checks on the head also passed:
2. Prepared execution and concurrent authorization changesA persistent prepared
A concurrent probe then ran 400 direct/prepared SHOW statements across four connections while another session performed 200 GRANT/REVOKE transitions. Outcomes were 354 visible and 46 ordinary privilege denials, with zero unexpected errors, cache-key errors, or hangs. 3. Custom white-box and unhappy-path probesOnly newly added
4. Measured scalability risk: serial role-closure depthFocused local medians (50 iterations for depth 3, 20 for depth 64):
The shared admin-path median did not regress in the corresponding comparison: base The scalability result is consistent with the implementation: 5. Compatibility item to confirm (source-only)For protocol 11, Publication allowlisting was traced statically but was not dynamically exercised in this round. Remote RPC/retry, multi-CN cancellation, and vector-aggregation paths are also outside the executed coverage; no claim is made that those paths were dynamically validated. |
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32855. Backports #30304 to
4.2-dev. The original report is #30279.What this PR does / why we need it:
A user with SELECT on a table can query its rows, yet the database-level SHOW privilege check rejects inspection of its columns and CREATE TABLE definition. This backport binds each SHOW statement to its actual target database and consults object privileges after an ordinary database-level denial. SHOW TABLES uses the same visibility rules so a grant on one table exposes only the permitted names. Subscription publication allowlists and view-definition restrictions still apply.
The release branch needs the execution-time role lookup and identity propagation that main already had when #30304 landed. The new code resolves active and inherited roles against the executing transaction, bounds role traversal, and reuses the result within one physical execution. Prepared SHOW statements refresh the relevant metadata and authorization when executed, including after a revoke or a publication change.
Protocol compatibility. Release protocol 12 corresponds to main's protocol 41 for object-only SHOW TABLES admission and filtering. Release protocol 11 keeps the database-level gate and its existing listing behavior. The mapping is specific to this capability.
Historical SQL validation (original backport head
dd7b10f9c4360e486a4008b8fdbc27178718a219). Three SQL regression suites ran on macOS arm64. The privilege suite passed 1,746 checks with 2 ignored, publication/subscription passed 1,693, and dml/show passed 613 with 23 ignored. The issue-specific subsets passed 25/25 and 22/22. Coverage includes exact visible names, table metadata access, revoke/regrant, prepared execution, and publication changes. Four additional plain SHOW TABLES executions through an isolated two-CN proxy returned exactly the 64 expected names after worker labels changed. Statement history recorded success but did not retain physical placement.Validation limits. Arbitrary in-flight protocol downgrade was not tested. Timing samples did not establish a reliable latency comparison. A separate stress query adding a large generated series encountered a remote execution failure under forced placement. Its behavior on the unmodified release base has not been established.
CI repair validation (08b9738). Completed the Apache 2.0 headers in two added test files identified by SCA run 44226249385, job 134540120015, attempt 1. Newly ran
license-eye -c .licenserc.yml header checkusing CI-pinned v0.4.0: 4,888 valid, zero invalid; the focused two-file check,git diff --check, and formatting checks also passed. Package declarations, imports, and test code are byte-for-byte unchanged fromdd7b10f9c4360e486a4008b8fdbc27178718a219; the SQL validation above is reused. No runtime tests were rerun for this comment-only repair; the remaining SCA analyzers will run in the new CI.SCA error-path repair (8e010d7). Run 44229764080, attempt 1 passed license checks and reported SA5001 in the new role-root query helper; CI Required propagated that failure. The helper now checks the SQL error before deferring cleanup and explicitly closes partial results on failure. Added error cases for account, primary-role grant, and all-role grant queries assert original-error propagation and released result memory. Newly passed on macOS arm64 with CI Go 1.26.4: owning-package build/vet;
mo-cgo-testidentity matrix, full package normal/race, and identity-race -count=100; compiler testsTestCurrentRolesExecutionCacheScopeAndGenerationandTestShowRolesCompiledCacheGeneration; CI-pinned golangci-lint 2.6.2 with.golangci.ymlon./pkg/sql/colexec/table_function(0 issues); focused license and formatting checks. Native dependencies were built from this release tree. Original SQL evidence is reused; full Linux CI awaits the new push.Review repair validation (bbd3093). Object-only SHOW fallback now accepts an explicit set of row-local predicate operators; subqueries, function calls and unknown forms are rejected before execution. SHOW TABLES carries its database/object admission into planning: database admission avoids role traversal, object admission cannot select an unfiltered legacy plan, and prepared rebuilds refresh admission against the prepared database. Newly passed with Go 1.26.4/native CGO on macOS arm64: frontend/planner/AST build, vet and owning-package tests; each of four predicate/admission/prepared/rollback tests with
-race -count=100; and the authenticated SQL regressionTestShowMetadataAdmissionIsolationwith-short -tags matrixone_test -race. That regression proves exact visible names, rejected unauthorized predicate reads, database SHOW grants, and prepared execution after revoke. An original-head production-source overlay fails the same regression precisely because the malicious SHOW returns no error. Final protocol-transition edits are covered by the deterministic in-planning downgrade test; unchanged-input public SQL evidence is reused. CI-pinned golangci-lint 2.6.2 reports 0 issues, headers and artifact checks pass. Full BVT and a 4,097-role SQL fixture were not rerun; the typed planner test verifies that database admission installs no role-closure CTE.SCA test-probe repair (771106f). Run 44266293888, attempt 1 reported rowserrcheck/sqlclosecheck in the new SQL regression. Expected-error SHOW probes now use
ExecContext, retaining the exact rejection assertion and the successful-listing Rows checks. Newly passed with Go 1.26.4/native CGO: owningpkg/tests/issues/isolatedvet and all configured golangci-lint 2.6.2 checks (0 issues);TestShowMetadataAdmissionIsolationwith-short -tags matrixone_test -race -count=1(20.058s); header and diff checks. The package is test-only, and the regression command compiled its test binary. Production code and earlier review validation are reused unchanged.Review repair validation (1487d93). SHOW COLUMNS uses the same target database for authorization and planning, and prepared SHOW metadata keeps the database selected at PREPARE. Object-authorized SHOW TABLES reads visibility at the statement authorization snapshot while the user's SI data snapshot stays intact.
Newly passed on macOS arm64 with Go 1.26.4 and native CGO: frontend/planner/AST build, vet and package tests, focused frontend/planner race tests, and the public SQL regression
TestShowMetadataAdmissionIsolationwith-short -tags matrixone_test -race -count=1(33.756s). The regression covers RC and SI, database precedence, text and binary PREPARE across USE, and revocation during an open transaction. The tagged test vet, golangci-lint 2.6.2 for the changed diff, and the PR artifact check also passed. Earlier CI evidence applies to771106ffdbafdab15b88b09dddc0bfab69236771. Linux and multi-CN verification for the repair will run on the new commit.Object identity regression validation (
23dbcfa799d651e289361b20620a92ff4790588f). Object-authorized SHOW COLUMNS and SHOW CREATE TABLE now resolve and read the target in the statement authorization snapshot. Text and binary EXECUTE refresh admission before planning, and the user transaction keeps its data snapshot.Newly passed on macOS arm64 with Go 1.26.4 and native CGO: frontend, planner and AST build/vet and package tests, tagged vet for the isolated SQL test package, frontend package race, 100 focused race rounds of
TestRebuildPreparedShowRefreshesAdmission, and changed-line golangci-lint 2.6.2 (0 issues).TestShowMetadataAdmissionIsolationpassed with-short -tags matrixone_test -race -count=1in RC and SI, including direct and prepared metadata for the replacement object and an independent SI data read. The same final test fails on an overlay of the reviewed production files because it observes the old object. Linux CI will run on this commit.Pipeline cancellation validation (
8e9a5a47468411168bbe496ffb7015764ffb24c1). The execution owner classifies cancellation before cleanup. Merge and vector aggregation preserve the terminal result and release blocked siblings and shared role loaders with the originating failure. A graceful local stop still leaves the shared execution cache usable.Newly passed on macOS arm64 with Go 1.26.4 and native CGO. The
mo-cgo-testnormal suites passed for compile, table functions and pipeline, and full race suites passed for compile and table functions. Five focused race tests each passed 100 rounds, covering independent child cancellation, graceful stop, vector branch lifecycle, retry generations and shared cache retirement. The original head reproduces the missing parent cancellation with the same race regression. Build, vet, changed-line golangci-lint 2.6.2 and the artifact check passed. The test runner used the OS temporary directory because the local file service filters the hidden ancestor in the default Loom temp path. Linux CI will run on this commit.Conflict resolution and validation (
250e9da34224f8e76dd1cae4777d80cfe5c16e98). Rebased onto official4.2-devatf4dc8554a3bd4f92d1e009cb2dcb2bd227036861. The scope uses the release branch's pre-cleanup cancellation classification and diagnostics. Merge and vector aggregation retain the terminal error and release blocked role loaders. MORPC 11 remains the immediate predecessor of this PR's protocol 12.Newly passed on Darwin/arm64 with Go 1.26.4 and native CGo. Build, vet, and normal and race suites passed for compile, table functions, and pipeline. Nine focused compiler tests each passed 100 race repetitions, covering independent child errors, local stop, serial and parallel reader failures, and retry and registration boundaries. The authenticated
TestShowMetadataAdmissionIsolationpassed in RC and SI under race. The PR artifact check passed. The prior head's Linux run completed successfully on attempt 2. Linux verification of this rebase will run on the new head. Prior Linux CI