-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(acl): fix duplicate groot user creation #9041
base: main
Are you sure you want to change the base?
Conversation
fff5058
to
8cb6aec
Compare
6b76bc6
to
fcfddbe
Compare
fcfddbe
to
0c99f28
Compare
b38fc4e
to
0ddedc3
Compare
03cb2b2
to
d79d3b9
Compare
7f4b1e6
to
82193f7
Compare
b296a22
to
766ddf5
Compare
766ddf5
to
437ffa2
Compare
This PR adds the unique directive to the 'dgraph.xid' predicate. Prior to this change, users could create duplicate users leading to misconfiguration of ACL.
2ba7da6
to
fc5c502
Compare
@@ -0,0 +1,198 @@ | |||
//go:build integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be marked as integration2?
@@ -835,17 +838,54 @@ func IsPreDefPredChanged(update *pb.SchemaUpdate) bool { | |||
if !x.IsPreDefinedPredicate(update.Predicate) { | |||
return false | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not supposed to make changes to the schema. We need to break it down into two steps. First step, we should update the schema to what it should be. And then call this function "IsPreDefPredChanged" and not make any changes in the code of this function. See the code where it is being called from. It maybe useful to update the name of the function and do both steps in just one function so that it can be used in other places too if needed.
// isDgraphXidChangeValid returns true if the change in the dgraph.xid predicate is valid. | ||
func isDgraphXidChangeValid(original, update *pb.SchemaUpdate) bool { | ||
changed := compareSchemaUpdates(original, update) | ||
if len(changed) == 1 && changed[0] == "Unique" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can directly do return len(changed) == 1 && changed[0] == "Unique"
This PR adds the unique directive to the 'dgraph.xid' predicate. Prior to this change, users could create duplicate users leading to misconfiguration of ACL.