Repository navigation
Description
Existing issue search:
- I have searched existing issues to avoid duplicates
Branch Name: main
Commit ID: e2459cc55f4b514893e19732743460bc5f16d552 (2026-11-09)
Environment: Local single-node launch (CN + TN + LogService in one process tree), macOS arm64, freshly compiled from current main, clean catalog. MySQL 8.3.0 used for cross-checking behavior on the same machine.
Actual Behavior:
GRANT SELECT(col1, col2) ON TABLE ... TO PUBLIC is silently accepted, but the column list is dropped entirely — the grant becomes a full-table SELECT grant, and because every account inherits public, all users gain full-table read access to all columns.
Two additional edge findings from the same test:
GRANT SELECT(col) ON TABLE t TO <specific_user>fails withthere is no role <user>— the column-privilege path apparently treats the grantee as a role only.- The PUBLIC path succeeds silently, which is the dangerous direction.
Verification shows the AST layer parses and stores the column list (Privilege.ColumnList in pkg/sql/parsers/tree/revoke.go), but pkg/frontend/authenticate.go contains zero consumption of ColumnList — the column restriction vanishes between parsing and privilege enforcement.
Expected Behavior:
- Either reject column-level GRANT syntax explicitly (
ERROR: column-level privileges not supported), or implement actual column-level enforcement. TO PUBLICwith a column list must never silently degrade into a full-table grant visible to all accounts.GRANT ... TO <user>with a column list should not fail with "there is no role " (a user should be a valid grantee, same as table-level grants).
Steps to Reproduce:
-- 1. Setup
CREATE DATABASE bh1;
CREATE TABLE bh1.t (id INT PRIMARY KEY, c_pub INT, c_secret VARCHAR(32));
INSERT INTO bh1.t VALUES (1, 10, 'credit-card-1234');
CREATE USER u_colv IDENTIFIED BY 'B1!';
-- 2. Column-level grant restricted to c_pub, granted to PUBLIC
GRANT SELECT(c_pub) ON TABLE bh1.t TO PUBLIC;
-- → returns OK, silently
-- 3. Login as u_colv (who only inherits public)
-- 3a. Read the UNAUTHORIZED column:
SELECT c_secret FROM bh1.t;
-- → returns 'credit-card-1234' (should be DENIED)
-- 3b. SELECT *:
SELECT * FROM bh1.t;
-- → returns all columns (should be DENIED)
-- 4. Contrast: grant to a SPECIFIC user instead
GRANT SELECT(c_pub) ON TABLE bh1.t TO u_colv;
-- → ERROR 20101 (HY000): internal error: there is no role u_colv
-- (unauthorized-column reads are correctly denied only because
-- this grant failed, not because columns are enforced)Severity: Security. The dangerous combination is "syntax accepted + column list dropped + PUBLIC inherited by every account". An operator may believe they granted 2 columns while the entire table (including sensitive columns) becomes readable by all users.
Cross-reference: Verified at least 3 times on 2026-11-09/10 against current main. Storage layer is fine (privilege row lands in mo_catalog.mo_role_privs); the defect is in the parse-to-enforcement path (Privilege.ColumnList never consumed).
Activity
[-][Bug]: Column-level GRANT silently accepted but column list dropped — degrades to full-table grant visible to every account (via PUBLIC)[/-][+][Bug]: Column-level GRANT silently degrades to full-table grant[/+]fix(sql): reject column privileges and render granted object scopes (#…
XuPeng-SH commentedon Nov 13, 2026
QA handoff (main, not acceptance)
Merged fix: #32649, main merge SHA
2573b2895bb73af99c95960c2f5595edde7b62b1(reviewed PR headfb85c8024e5401e6a627ff2e6fda1d4ab71aa85a). The fix explicitly rejects column-qualified GRANT and REVOKE with error 20105 before role lookup or privilege mutation, including mixed privilege lists. Whole-object grants are retained; this does not implement column-level authorization or direct per-user object grants.Evidence reviewed: the merged guard and committed regressions; the author's report of six BVT scripts (992 successful, 18 existing-issue skips, 0 failed/abnormal) and full-graph pinned static checks; the same-head review reports 9 focused frontend/planner roots / 16 executions passing without skips. These are remote author/reviewer reports, not tests executed in this handoff run. Raw per-case CI/author artifacts were not independently checked here, and no fresh main server/BVT run was performed.
No current applicable verified counterexample or unfinished development follow-up was found in the complete issue/PR discussion. Handing to @Ariznawlll for QA; keep this issue open pending acceptance. Please verify rejection and absence of partial mutation for PUBLIC, role/user grantees, mixed lists and both GRANT/REVOKE, plus unchanged whole-object grant/revoke controls. Check fresh-session behavior and existing grants separately: rejection of new column-qualified statements is not proof of remediation of previously widened grants. Direct-user grant semantics remain a separate issue (#32478). No 4.2 backport is requested by this handoff.
Ariznawlll commentedon Nov 16, 2026
测试版本
7fcd9bdff8433d72983f0399fd5c10dcab91a00a;修复 PR fix(sql): reject column privileges and render granted object scopes #32649 已 MERGED,merge commit2573b2895bb73af99c95960c2f5595edde7b62b1在该 main 的祖先链(同 PR 亦修复 [Bug]: SHOW GRANTS renders granted object as literal 'd.t' #32446)。git_version() = 7fcd9bdff8。原问题验证
按 issue 步骤构造 bh1.t 与 u_colv:
GRANT SELECT(c_pub) ON TABLE t TO PUBLIC现在返回ERROR 20105 (HY000): not supported: column-level privilege select,不再静默 OK;以 u_colv 登录后SELECT c_secret、SELECT *均报ERROR 20101: do not have privilege to execute the statement。原报告的"PUBLIC 静默降级后任意用户可读敏感列"路径未复现。Happy Path 覆盖
GRANT SELECT ON TABLE t TO PUBLIC仍正常成功,public-default 用户实际能读到全表,随后REVOKE ... FROM PUBLIC正常收回。GRANT SELECT ON TABLE t TO r+GRANT r TO u(default role r)后该用户可正常读取全表。SHOW GRANTS FOR <user>正常渲染经角色继承的对象授权(GRANT select ON table ...),与 fix(sql): reject column privileges and render granted object scopes #32649 同 PR 触碰的渲染路径一致。Unhappy Path 覆盖
GRANT SELECT(c_pub) ... TO PUBLIC(危险方向)→ ERROR 20105,未持久化任何权限。GRANT SELECT(c_pub) ... TO <user>→ ERROR 20105,不再是误导性的there is no role <user>。SELECT(c_pub, c_secret)与第二权限种类INSERT(c_secret)同样被 20105 拒绝;列级REVOKE SELECT(c_pub)同样拒绝。c_secret、SELECT *乃至授权列c_pub的读取全部报 20101——静默降级路径已封死。白盒验证
核对已合入的 #32649:
doGrantPrivilege/doRevokePrivilege在角色查找与持久化之前调用checkNoPrivilegeColumnList对列级权限 fail-closed(20105);整表授权路径未改动。另确认GRANT ... TO <user>报there is no role是既有设计(grantee 仅接受角色,官方 BVT 全部 grant to role),非本修复引入的回归。未修改产品源码。回归测试
已提交 matrixorigin/motr#350:
14_issue_regression/issue_32443_column_privileges_rejected,覆盖上述全部 happy + unhappy 路径。本 issue 与修复 PR 均落在 main(milestone MO-202611,无 4.2-dev backport),故回归 PR 目标为 motr main 分支。测试证据
本地 motr
--record建立基线后,diff 模式连续复跑两轮(含完整用户/角色/库清理,幂等性验证),并与 #32599 回归用例-j 2并行一轮:每轮 38/38 语句全绿、输出逐字节稳定;result 基线随 PR #350 提交。测试结论
测试通过。
Ariznawlll commentedon Nov 16, 2026
验证通过(comment),回归测试已提交 motr#350。关闭。