You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: renaming a controlled table bypasses its row filter #29133
After a controlled table is renamed, the persisted rule remains associated with the old table name and is no longer applied to the renamed table. A user with the role can read rows that the original rule filtered out.
Reproduction
CREATEDATABASErcac_ddl;
CREATETABLErcac_ddl.t (id INTPRIMARY KEY, tenant INT, amount INT);
INSERT INTOrcac_ddl.tVALUES (1,1,100),(2,2,200);
CREATE ROLE rcac_ddl_r;
ALTER ROLE rcac_ddl_r
ADD RULE 'select id, amount from rcac_ddl.t where tenant = 1'ON TABLE rcac_ddl.t;
CREATEUSERrcac_ddl_u IDENTIFIED BY '...' DEFAULT ROLE rcac_ddl_r;
GRANT CONNECT ON ACCOUNT * TO rcac_ddl_r;
GRANTSELECTON TABLE rcac_ddl.t TO rcac_ddl_r;
ALTERTABLErcac_ddl.t RENAME TO rcac_ddl.t_renamed;
SHOW RULES ON ROLE rcac_ddl_r;
Actual metadata remains stale:
rule_name rule
rcac_ddl.t select id, amount from rcac_ddl.t where tenant = 1
As rcac_ddl_u:
SET enable_remap_hint =1;
SELECT id, amount FROMrcac_ddl.t_renamedORDER BY id;
Actual result (tenant=2 row leaks):
id amount
1 100
2 200
Expected result must remain restricted to the original rule predicate:
id amount
1 100
Expected behavior
ALTER TABLE ... RENAME must either update the row/column-rule dependency to the new object name or safely block/cascade the DDL. A renamed object must never become an unfiltered access path.
Stability and cleanup
Reproduced once in a clean, isolated local service. Temporary user, role, database, table, and rule will be removed after evidence capture.
Regression and extended verification for #29133 (2026-10-16)
Verification Environment
Latest MatrixOne origin/main: b24d1b311555e0b6f3d56eb37f9a2e9617e9a5b7 — fix(window): support temporal interval frame parameters and string parsing (#30310). git fetch origin main confirmed this revision; the running mo-service binary reported it, and all five service processes had the same executable checksum.
Related fix: PR #29186, merge commit 51300cbd01fc9687211ef76d71470764e1d365e0 — fix: prevent table rename from bypassing role row filters. The fix is present in the tested main.
Isolated topology: 2 CN / 1 TN / 1 Log service / 1 Proxy. The reachable service endpoints were Proxy mo-proxy:6001, CN1 mo-cn1:16001, and CN2 mo-cn2:16002.
Client: MySQL 8.4 CLI using the native MySQL text protocol with persistent authenticated sessions where required. The test used a dedicated database, role, and user; all were removed and catalog teardown counts were 0.
What Was Covered
OK — Original controlled-table scenario: before rename, the role user saw only tenant=1 (id=1) through Proxy, CN1, and CN2. ALTER TABLE ... RENAME TO was rejected with 20105 / HY000 on all three endpoints. The original table and rule remained in place, and the user still saw only the permitted row afterward.
OK — RENAME TABLE was also rejected. A chained rename containing an unrelated table and the controlled table failed atomically: neither source table was renamed. While a role rule existed, an unrelated table rename was conservatively rejected as documented by the fix.
OK — No-rule controls: both rename syntaxes worked before the rule was added and again after it was removed. An existing session on the same CN as DROP RULE refreshed and then saw both rows, as expected after policy removal.
OK — Focused exact-main tests passed: TestIssue29133RenameAdmissionSerializesRoleRuleWrite (2-CN lock ordering), TestRoleRuleRenameAdmissionProtocol, and TestInvalidateRoleRuleCachesAcrossSessions.
Failed — Cross-CN persistent-session policy update: a CN1 user session first queried the table with no rule and saw id=1,2. CN2 then successfully added a rule allowing only tenant=1. A fresh CN1 session saw only id=1, but the already-open CN1 session continued to see id=1,2, including the newly forbidden tenant=2 row. Repeating the query and setting enable_remap_hint=1 again did not clear it. CN1's rename admission nevertheless rejected a rename, so this is a separate cross-CN session-cache enforcement gap rather than failure of the new rename guard.
Not covered — Restart/upgrade and full mo-tester group replay. The direct security witness and focused tests above were executed on the exact-main runtime.
Findings
The original rename-based bypass is prevented by conservative DDL rejection, but row-filter enforcement is not yet safe across pre-existing sessions on another CN when a rule is added. The observed stale unrestricted result is consistent with the current CN-local session-cache invalidation; the precise ownership fix needs developer investigation. This is not merely metadata lag: the catalog and a fresh CN1 session already reflected the new rule while the old CN1 session still disclosed the forbidden row.
MOTR / BVT Coverage
The merged fix already has SQL coverage in test/distributed/cases/zz_accesscontrol/role_rule.sql and .result, plus the focused Go tests named above.
No passing MOTR case, issue commit, branch push, or daily-PR entry was created. The newly identified cross-CN persistent-session case fails on current main; it needs a product fix and then a regression case that can pass during record/replay.
Final Conclusion
Partially fixed.ALTER TABLE ... RENAME TO and RENAME TABLE no longer bypass an existing rule, including through both CNs and Proxy. However, a pre-existing session on a different CN can still read rows excluded by a rule added after that session cached the no-rule state. Do not treat the broader row-filter security invariant as fully verified.
Large-data regression: not needed. The failure depends on cross-CN session/cache state and rule lifecycle, not row count, block/batch size, spill, or throughput. The minimum stable witness uses 2 rows, 2 CNs, and 1 persistent user session.
Regression and extended verification for #29133 (2026-10-21)
Verification Environment
MatrixOne origin/main: 63a964a82fbaae4759cfabb45655e0185bc0979c — fix(plan): filter LOAD IGNORE constraints before writes (#30619). Fetched before validation and rechecked against the remote after testing. The isolated mo-service was rebuilt from this exact checkout; --version reported commit 63a964a82f, and its SHA-256 was e0d306c14e3de6d105cc3cc567fba1914f2890ce4c47621f7744e0237b16bca2.
Relevant fixes: PR #29186, merge commit 51300cbd01fc9687211ef76d71470764e1d365e0 (fix: prevent table rename from bypassing role row filters), and PR #30400, merge commit 7d93ece8290aba0dc3bba9682ae16ece0f8c5494 (fix(frontend): refresh role rules across CN sessions). Both are ancestors of the tested main.
Isolated local topology: 2 CN services / 1 TN service / 1 Log service / 1 Proxy, hosted by one local launcher process. All three MySQL endpoints were reachable: Proxy 6001, CN1 16001, and CN2 16002.
Clients: PyMySQL persistent connections using the MySQL text protocol for direct three-endpoint checks; Go database/sql + go-sql-driver/mysql for the existing real binary prepared-statement integration test; mo-tester/JDBC for the existing SQL BVT.
What Was Covered
OK — Original controlled-table scenario: with a role row rule in place, both ALTER TABLE ... RENAME TO and RENAME TABLE returned 20105 through Proxy 6001, CN1 16001, and CN2 16002. The original table and rule remained; the existing BVT also checked restricted reads after the rejected renames.
OK — Cross-CN persistent sessions: before a rule, existing connections through all three endpoints saw IDs [1,2]. CN2 added a rule permitting only tenant 1; those same connections immediately saw [1]. CN1 replaced it with a tenant 2 rule, yielding [2]; CN2 dropped it, yielding [1,2]. No reconnect was used for these checks.
OK — No-rule control: both rename syntaxes succeeded after the rule was dropped. The issue-specific two-CN tests TestIssue29133RoleRulesTrackRemoteChanges and TestIssue29133RenameAdmissionSerializesRoleRuleWrite passed with -count=1; they include native prepared-statement refresh and concurrent rename/rule-write boundaries.
OK — Existing test/distributed/cases/zz_accesscontrol/role_rule.sql passed normal mo-tester comparison twice on the same service instance: 292/292 statements each time, 0 failures. Post-run counts for test rules, databases, and the dedicated account were 0; Proxy remained healthy after the checks.
Not covered — Restart/upgrade, separate-host or separate-process deployment, and production throughput/latency acceptance. This was a functional security regression on an isolated local topology, not a performance or failover run.
Findings
The previously reported stale-policy result on an already-open remote CN session did not recur on this main. The rule-refresh fix in PR #30400 and the earlier conservative rename guard in PR #29186 both held under the exercised text and prepared paths. PR #30400 separately records an open default-performance acceptance question; this verification makes no performance claim.
MOTR / BVT Coverage
Existing MatrixOne BVT and issue-specific integration tests already cover the distinct public SQL, cross-CN session, binary prepared-statement, and rename/rule-write race contracts. No duplicate MOTR case, issue branch, commit, push, or daily-PR entry was needed. No MatrixOne service source was modified.
Final Conclusion
Fixed for the reported rename-based row-filter bypass and the previously observed cross-CN stale-session disclosure on the tested main. This supersedes the functional Partially fixed assessment from 2026-10-16; the performance question remains outside this conclusion.
Large-data regression: not needed. The security boundary depends on rule lifecycle, session-cache freshness, and cross-CN ordering, not row count, block/batch size, memory spill, or data skew. A stable witness uses 2 rows and 2 CN services.
Activity
fix: prevent table rename from bypassing role row filters (#29186)
slyunnn commentedon Oct 16, 2026
Regression and extended verification for #29133 (2026-10-16)
Verification Environment
origin/main:b24d1b311555e0b6f3d56eb37f9a2e9617e9a5b7—fix(window): support temporal interval frame parameters and string parsing (#30310).git fetch origin mainconfirmed this revision; the runningmo-servicebinary reported it, and all five service processes had the same executable checksum.51300cbd01fc9687211ef76d71470764e1d365e0—fix: prevent table rename from bypassing role row filters. The fix is present in the testedmain.2 CN / 1 TN / 1 Log service / 1 Proxy. The reachable service endpoints were Proxymo-proxy:6001, CN1mo-cn1:16001, and CN2mo-cn2:16002.8.4CLI using the native MySQL text protocol with persistent authenticated sessions where required. The test used a dedicated database, role, and user; all were removed and catalog teardown counts were0.What Was Covered
tenant=1(id=1) through Proxy, CN1, and CN2.ALTER TABLE ... RENAME TOwas rejected with20105/HY000on all three endpoints. The original table and rule remained in place, and the user still saw only the permitted row afterward.RENAME TABLEwas also rejected. A chained rename containing an unrelated table and the controlled table failed atomically: neither source table was renamed. While a role rule existed, an unrelated table rename was conservatively rejected as documented by the fix.DROP RULErefreshed and then saw both rows, as expected after policy removal.TestIssue29133RenameAdmissionSerializesRoleRuleWrite(2-CN lock ordering),TestRoleRuleRenameAdmissionProtocol, andTestInvalidateRoleRuleCachesAcrossSessions.id=1,2. CN2 then successfully added a rule allowing onlytenant=1. A fresh CN1 session saw onlyid=1, but the already-open CN1 session continued to seeid=1,2, including the newly forbiddentenant=2row. Repeating the query and settingenable_remap_hint=1again did not clear it. CN1's rename admission nevertheless rejected a rename, so this is a separate cross-CN session-cache enforcement gap rather than failure of the new rename guard.Findings
The original rename-based bypass is prevented by conservative DDL rejection, but row-filter enforcement is not yet safe across pre-existing sessions on another CN when a rule is added. The observed stale unrestricted result is consistent with the current CN-local session-cache invalidation; the precise ownership fix needs developer investigation. This is not merely metadata lag: the catalog and a fresh CN1 session already reflected the new rule while the old CN1 session still disclosed the forbidden row.
MOTR / BVT Coverage
test/distributed/cases/zz_accesscontrol/role_rule.sqland.result, plus the focused Go tests named above.main; it needs a product fix and then a regression case that can pass during record/replay.Final Conclusion
Partially fixed.
ALTER TABLE ... RENAME TOandRENAME TABLEno longer bypass an existing rule, including through both CNs and Proxy. However, a pre-existing session on a different CN can still read rows excluded by a rule added after that session cached the no-rule state. Do not treat the broader row-filter security invariant as fully verified.Large-data regression: not needed. The failure depends on cross-CN session/cache state and rule lifecycle, not row count, block/batch size, spill, or throughput. The minimum stable witness uses
2rows,2CNs, and1persistent user session.slyunnn commentedon Oct 21, 2026
Regression and extended verification for #29133 (2026-10-21)
Verification Environment
origin/main:63a964a82fbaae4759cfabb45655e0185bc0979c—fix(plan): filter LOAD IGNORE constraints before writes (#30619). Fetched before validation and rechecked against the remote after testing. The isolatedmo-servicewas rebuilt from this exact checkout;--versionreported commit63a964a82f, and its SHA-256 wase0d306c14e3de6d105cc3cc567fba1914f2890ce4c47621f7744e0237b16bca2.51300cbd01fc9687211ef76d71470764e1d365e0(fix: prevent table rename from bypassing role row filters), and PR #30400, merge commit7d93ece8290aba0dc3bba9682ae16ece0f8c5494(fix(frontend): refresh role rules across CN sessions). Both are ancestors of the testedmain.2CN services /1TN service /1Log service /1Proxy, hosted by one local launcher process. All three MySQL endpoints were reachable: Proxy6001, CN116001, and CN216002.database/sql+go-sql-driver/mysqlfor the existing real binary prepared-statement integration test; mo-tester/JDBC for the existing SQL BVT.What Was Covered
ALTER TABLE ... RENAME TOandRENAME TABLEreturned20105through Proxy6001, CN116001, and CN216002. The original table and rule remained; the existing BVT also checked restricted reads after the rejected renames.[1,2]. CN2 added a rule permitting only tenant1; those same connections immediately saw[1]. CN1 replaced it with a tenant2rule, yielding[2]; CN2 dropped it, yielding[1,2]. No reconnect was used for these checks.TestIssue29133RoleRulesTrackRemoteChangesandTestIssue29133RenameAdmissionSerializesRoleRuleWritepassed with-count=1; they include native prepared-statement refresh and concurrent rename/rule-write boundaries.test/distributed/cases/zz_accesscontrol/role_rule.sqlpassed normal mo-tester comparison twice on the same service instance:292/292statements each time,0failures. Post-run counts for test rules, databases, and the dedicated account were0; Proxy remained healthy after the checks.Findings
The previously reported stale-policy result on an already-open remote CN session did not recur on this
main. The rule-refresh fix in PR #30400 and the earlier conservative rename guard in PR #29186 both held under the exercised text and prepared paths. PR #30400 separately records an open default-performance acceptance question; this verification makes no performance claim.MOTR / BVT Coverage
Existing MatrixOne BVT and issue-specific integration tests already cover the distinct public SQL, cross-CN session, binary prepared-statement, and rename/rule-write race contracts. No duplicate MOTR case, issue branch, commit, push, or daily-PR entry was needed. No MatrixOne service source was modified.
Final Conclusion
Fixed for the reported rename-based row-filter bypass and the previously observed cross-CN stale-session disclosure on the tested
main. This supersedes the functionalPartially fixedassessment from2026-10-16; the performance question remains outside this conclusion.Large-data regression: not needed. The security boundary depends on rule lifecycle, session-cache freshness, and cross-CN ordering, not row count, block/batch size, memory spill, or data skew. A stable witness uses
2rows and2CN services.