Skip to content

fix data branch privilege model - #24875

Merged
mergify[bot] merged 5 commits into
matrixorigin:mainfrom
gouhongshen:codex/data-branch-privilege
Jun 9, 2026
Merged

fix data branch privilege model#24875
mergify[bot] merged 5 commits into
matrixorigin:mainfrom
gouhongshen:codex/data-branch-privilege

Conversation

@gouhongshen

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #24840

What this PR does / why we need it:

This PR fixes the systemic privilege model for DATA BRANCH statements so branch operations require the same privileges as the ordinary SQL reads and writes they logically perform.

Main changes:

  • Adds a centralized DATA BRANCH privilege resolver for create/delete/diff/merge/pick statements.
  • Aligns DATA BRANCH CREATE TABLE with source SELECT plus destination CREATE TABLE.
  • Aligns DATA BRANCH CREATE DATABASE with CREATE DATABASE plus source table/view read checks, sharing clone database source resolution with execution.
  • Aligns DATA BRANCH DIFF with SELECT on both inputs.
  • Aligns DATA BRANCH MERGE and PICK with source/destination reads plus destination INSERT/UPDATE/DELETE.
  • Prevents DATA BRANCH DELETE from dropping ordinary non-branch objects by validating active branch metadata before DDL.
  • Quotes internally generated database/table/account identifiers consistently, including TO ACCOUNT.
  • Adds a design document and BVT coverage for missing-permission paths, quoted TO ACCOUNT, subscription sources, and destructive delete safety for empty/view-only/sequence-only/mixed databases.

Validation:

  • go test ./pkg/frontend
  • make build
  • mo-tester -m genrs -i branch_privilege
  • mo-tester -i branch_privilege (TOTAL:249 SUCCESS:249 FAILED:0)
  • git diff --check

@mergify mergify Bot added the queued label Jun 9, 2026
@mergify

mergify Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-06-09 07:12 UTC · Rule: main
  • Checks passed · in-place
  • Merged2026-06-09 08:16 UTC · at e3e902fbaae81e45aad545fc0f273e87c12c43bb · squash

This pull request spent 1 hour 4 minutes 25 seconds in the queue, including 1 hour 3 minutes 43 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Ubuntu/x86
    • check-neutral = Matrixone CI / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage

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

Labels

kind/bug Something isn't working kind/documentation Improvements or additions to documentation kind/test-ci size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants