Repository navigation
Description
Description
An Arrow IPC LOAD DATA issued by a user without INSERT privilege reaches the configured S3 object store before MatrixOne rejects the statement for privilege denial.
The statement does not write rows, but authorization is not enforced before the external-object access. This can expose unnecessary object reads and makes denied requests depend on object-store availability.
Environment
- Branch:
main - Commit:
269d59addd032d20897cc4d86f58de3e387a6d76 - Deployment: isolated 1-CN embedded MatrixOne cluster; Arrow LOAD and S3 Arrow LOAD explicitly enabled; local version-compatible MinIO and an HTTP observing proxy.
- Date: 2026-09-10
Steps to reproduce
- Create a database/table and insert one owner-controlled seed row.
- Start local MinIO with a valid Arrow IPC File object. Route its S3 endpoint through a proxy that records any object-store request.
- Create a non-owner user/role with only
CONNECTon the account; grant no INSERT/table privilege. - Connect through the MySQL protocol as that user and execute Arrow
LOAD DATA URL S3OPTION ...into the owner table. - Observe the SQL result, proxy state, and owner-side row count. Then execute the same LOAD as the owner as a happy-path control.
Actual behavior
- The non-owner statement is rejected with:
internal error: do not have privilege to execute the statement. - The proxy records an S3 request before that denial.
- The table remains seed-only after the denied statement.
- The owner retry succeeds and produces the expected second row.
Expected behavior
A user who lacks INSERT permission should be rejected before MatrixOne performs S3/Arrow object access. The rejected request must leave the target table unchanged, and the normal owner control must continue to succeed.
Stability and controls
- Reproducer: 3/3 failures on the latest official main.
- Happy-path control: 3/3 owner retries succeeded using the same valid Arrow object.
- Failure atomicity: 3/3 denied statements left exactly the original seed row.
Evidence
Reproducer command:
go test ./pkg/tests/arrowload -run '^TestArrowLoadPermissionDeniedDoesNotReadOrWrite$' -count=3 -timeout=180s
Each run failed only because the proxy observed object access. The denial and row-count checks completed as expected.
Code analysis
Observed behavior is consistent with Arrow external-scan compile setup obtaining the external file list/size and Arrow planning data before the later execution privilege rejection. This is a hypothesis based on the reproduction, not a proposed fix.
Regression coverage
A focused public-protocol regression is prepared in pkg/tests/arrowload/arrow_load_lifecycle_test.go as TestArrowLoadPermissionDeniedDoesNotReadOrWrite. It intentionally remains failing until the product ordering is fixed and should be landed with that fix.
Activity
fix(load): authorize Arrow LOAD before planning (#28633)
Ariznawlll commentedon Oct 21, 2026
测试版本
main67c91c5bdf6c669f63331778634215f7aa3e8f58(执行前后均核对为官方 main HEAD;修复 PR fix(load): authorize Arrow LOAD before planning #28633 的 merge commit)原问题验证
对
pkg/tests/arrowload/arrow_load_lifecycle_test.go中的TestArrowLoadPermissionDeniedDoesNotReadOrWrite执行go test -mod=readonly -p 4 ./pkg/tests/arrowload -run '^TestArrowLoadPermissionDeniedDoesNotReadOrWrite$' -count=3 -timeout=20m。该测试以真实 Arrow IPC 文件和 MinIO S3 对象,经观察代理执行原始的无 INSERT 权限LOAD DATA URL S3OPTION:3/3 均返回权限拒绝,代理记录 0 次对象请求,目标表始终只有(0, 'seed')这一行;未出现原先“拒绝前已访问 S3”的现象。JSON 测试事件分别为 3 个pass,耗时 5.71/4.78/4.63 秒,无skip。Happy Path 覆盖
TestArrowLoadBVT/PreparedDatabaseBinding在真实协议、2 CN 的嵌入式集群定向运行 3 轮;每轮Initial与SameInstance均通过。PREPARE 后切换会话数据库并改变sql_mode触发重规划,数据仍写入准备时数据库,当前会话数据库不被临时授权绑定改变。Unhappy Path 覆盖
白盒验证
pkg/frontend/load_preplan_auth_test.go中 6 个定向测试按-count=3通过,覆盖预规划目标识别、AST 目标、权限错误传播和数据库绑定。未执行 race 或多节点故障注入;本缺陷是授权与外部读取的顺序问题,实际对象访问已经由上面的公开协议集成测试观测。回归测试
修复 PR #28633 已合入本轮官方 main。PR 内的真实协议回归
pkg/tests/arrowload/arrow_load_lifecycle_test.go::TestArrowLoadPermissionDeniedDoesNotReadOrWrite定向 3/3,及现有 Arrow BVT 的PreparedDatabaseBinding定向 3 轮通过;已有 Go 集成回归直接断言对象请求数、权限拒绝和写入原子性,因此按当前约定不再向 MOTR #247 增加重复场景。本地未重跑整个 Arrow BVT;PR 的 Ubuntu/x86 UT、multi-CN BVT 及覆盖检查为 SUCCESS,不能把其他跳过的 CI 作通过证据。测试证据
测试结论
测试通过。