Repository navigation
fix(frontend): scope role-rule invalidation to owning account - #30358
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? |
|
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: 54e3b3ebd999f964b6e6f094327f0737d9319edc
Assessment: approve
Reviewed the complete eight-file delta, transaction boundaries, session lifecycle and prepared-policy consumers. The design appropriately reuses the existing invalidation owner, checks account identity under the recipient lock, and suppresses absent-role DROP broadcasts. Same-account stale handles still fail closed. Real mutations retain the existing session scan but avoid unrelated cache and prepared-handle traversal; no query-path work is added. No actionable defects remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Verified the frozen head, complete patch and unchanged source. Commands, source fingerprints, exits and logs are reconciled in /home/xupeng/.local/state/mo-bot/jobs/b21caff4ecbf1bbcccebff5b/attempt-1/review-evidence.json. Final audit receipt: 1792128477702759819-4.json.
-
Isolation preflight passed; independently verified 192 current native inputs and 19 retained build artifacts.
-
Full frontend suite passed normally and under race instrumentation: 2,459 and 2,458 top-level passes respectively.
-
Concurrent-account invalidation and in-flight cache reload each passed 100 race repetitions after measured runs.
-
Both live SQL/binary prepared-role tests passed twice on the same instance, including unrelated-account isolation, error 1615 and exact fresh-policy results.
-
The exact role_rule_prepared.sql BVT passed 51/51 assertions four times: twice normally and twice with metadata comparison. Explicit account, user, role and database teardown checks passed between runs.
-
The no-op regression test failed as expected with the exact merge-base DROP implementation overlaid. Candidate tests passed.
-
Changed-package go vet, gofmt and git diff --check passed.
Limitations:
-
Scope remains same-CN broadcast invalidation. Preexisting local privilege-cache invalidation in the initiating DDL session remains unchanged.
-
One existing test skipped itself; an existing allocation test is excluded under race instrumentation and passed normally.
-
The linked issue body was absent from frozen evidence; the PR supplied the reproduction and contract. Author-reported executions without retained receipts were not counted as independently verified.
-
No performance benchmark was run; the cost assessment follows the changed notification path.
Merge Queue Status
This pull request spent 2 hours 41 minutes 52 seconds in the queue, with no time running CI. ReasonPull request #30358 has been merged manually at 61e8b45 HintYou were too fast! Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #30347
What this PR does / why we need it:
Scope role-rule invalidation to the owning account, and do not broadcast an absent-role
DROP ROLE IF EXISTS.Root cause and reproduction
#29186 introduced an all-session CN broadcast after successful DROP ROLE and ALTER ROLE ADD/DROP RULE. It invokes the prepared-policy invalidation introduced by #29195, without checking account identity. Even an absent-role DROP commits successfully and invalidates another tenant's existing SQL/binary prepared handles.
Reproduced on host50 at unfixed main
b24d1b311555e0b6f3d56eb37f9a2e9617e9a5b7using the real embedded frontend and independently authenticated accounts on one CN:DROP ROLE IF EXISTS issue30347_absent.The same black-box test passes with this patch. The no-op DROP unit counterexample also fails on unfixed main. This is not a TPCC retry/Runner workaround. Attribution to #29186 is from the exact source diff and nightly evidence; the local runtime A/B is current unfixed main versus this patch.
Minimal fix / security boundary
This fixes unrelated-account interference on the existing same-CN broadcast path; it does not introduce a new cross-CN invalidation protocol.
Validation on host50 (Go 1.27.1)
pkg/frontend: PASS; fullpkg/frontend -race: PASS.TestInvalidateRoleRuleCachesConcurrentAccountsandTestCaptureRewritePolicyReloadsAfterInFlightInvalidation: each 100 race repetitions PASS, selected after a single measured race run.TestPreparedRoleInvalidationAccountIsolationplus existingTestNativePreparedRoleRuleSurvivesDisabledRemapHint: PASS, including same-instance repeated execution and final delivery rerun.zz_accesscontrol/role_rule_prepared.sql: normal mo-tester comparison 51/51 twice, with explicit account/role/user/database teardown checks between runs. Also 51/51 twice with result metadata comparison enabled. No new skipped assertions or generated-result acceptance.Self-review
Production changes are limited to the role-DDL notification closure. Tests reuse existing fixtures and the existing BVT case. Remote CI is separate from these completed local checks.