fix(frontend): invalidate revoked active roles in existing sessions - #27737
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 37bd6fb.
The prior blockers are closed:
- active-role membership is published only after the private transaction commits successfully;
- authorization uses a non-locking latest-committed RC read, avoiding same-user serialization;
- built-in role identity is tenant-aware, including sys-tenant custom role ID 2;
- cache generation prevents an old validation from repopulating after invalidation;
- cache OFF -> SET ROLE -> REVOKE -> ON now invalidates the stale decision before caching resumes.
I reviewed all production and test hunks, authorization fallbacks, role switching, prepared execution, session migration/cache-mode boundaries, transaction cleanup, and Q1-Q3 lifecycle/liveness/boundedness. The cache remains one bounded atomic entry, every private background transaction reaches finishTxn and Close, and no new unbounded wait or hot-path lock was introduced.
Exact-head CI is green, including frontend UT/coverage and standalone/compose BVT. The focused unit/race cases and public multi-session BVT cover committed revoke, old user transactions, prepared statements, cache-disabled mode, regrant, catalog/commit failures, and stale-generation races. No blocking correctness, performance, security-boundary, or unhappy-path issue remains.
aptend
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 37bd6fb. I read all historical reviews, inline comments, thread state, and issue #27650; compared the rebased patch series and the increment since my 110175b review; and rechecked the complete diff. The prior sys-tenant role-ID, transaction-publication, non-locking-read, and cache-mode blockers are materially closed. The new OFF→SET ROLE→REVOKE→ON fix both avoids publishing membership while caching is disabled and invalidates on every session cache-mode assignment; migration boundaries also invalidate. Q1-Q3 audit found one bounded atomic membership entry, complete transaction/BackgroundExec cleanup, generation-safe invalidation, and no added lock/wait cycle. Exact-head full frontend tests, focused race tests (three runs), go vet, and diff checks pass; exact-head CI, including frontend UT/coverage and standalone/compose BVT, is green. No blocking correctness, security, lifecycle, concurrency, or performance issue remains.
Merge Queue Status
This pull request spent 1 hour 33 minutes 29 seconds in the queue, with no time running CI. Waiting for any of
All conditions
ReasonPull request #27737 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Failing checks: HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. 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 #27650
What this PR does / why we need it:
REVOKE role FROM userclears the privilege cache, but an already-active session could refill that cache while continuing to authorize through the revoked active role and its older transaction snapshot. This change:clear_privilege_cacheboundary;Validation on commit
4e2be0b0eae7576bf291b5be928c45a0d2e6b1de(based onorigin/main424fe3d821e45fe883ab93af5b404d77686d05a0):mo-cgo-test -count=1 -coverprofile=frontend-cover.out ./pkg/frontend/...mo-cgo-test -race -count=1 ./pkg/frontend/...-race -count=7go vet -mod=readonly ./pkg/frontend/...make configmake err-checkgit diff --checkmo-testerBVT: 10 consecutive runs, 42/42 statements, 100%The new helper functions have 80%-100% function coverage; the main changed authorization/revoke functions are above the repository's 75% threshold.