Repository navigation
fix(acl): preserve user permissions across namespaces - #9812
Conversation
|
thank you for identifying the concurrency issue. GetUserPredPerms now copies the user’s permission map under RLock and returns an independent snapshot instead of exposing the cache’s live inner map. authorizePreds obtains that snapshot once and uses it throughout the authorization check. I also added the suggested cleanup for empty user entries and regression coverage confirming that cache updates and caller-side mutations cannot change a previously returned snapshot. The focused race test, the full worker package, and the full edgraph package all pass. I left the namespace-qualified outer-key redesign for a separate follow-up, as suggested. |
619ebab to
26a3c22
Compare
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Hi, @shiva-istari , @matthewmcneely I’ve rebased this PR onto the latest main and resolved the conflicts. All CI checks are passing. This bug has affected our service, so we’d appreciate it if you could take another look. Thanks! |
26a3c22 to
13da402
Compare
Description
AclCache.Updateclears cached permissions belonging to the namespace beingrefreshed. However, when writing the new
userPredPerms, it replaced theuser's entire predicate-permission map.
User IDs are namespace-local, so the same user ID can exist in multiple
namespaces. Refreshing ACLs for one namespace could therefore discard that
user's permissions from every other namespace.
Because
RefreshACLsiterates over a Go map of namespaces, the last namespaceloaded could differ between Alpha instances and restarts. This could leave
different Alpha instances with different allowed-predicate sets and affect
predicate discovery paths such as
expand(_all_).This change preserves the existing per-user map and merges the newly refreshed
namespaced predicates into it after removing only the permissions belonging to
the namespace being refreshed.
Regression tests cover:
This addresses the same-user collision not covered by the different-user
multi-namespace scenario added in #8418.
Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit