-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(AclFamily): add AUTH for acl members #1732
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
Changes from 13 commits
f6d8d1e
f4dbe93
d37290a
0cf215e
20412b9
9d3b767
cc2432d
c0356d8
2251f8e
ff6e3f0
16aa85f
d98d270
d84ff8f
b4a9163
cdfdb29
dba320c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,8 @@ class UserRegistry { | |
|
||
// Acquires a read lock | ||
// Used by Auth | ||
bool AuthUser(std::string_view username, std::string_view password) const; | ||
std::pair<bool, const std::string_view> AuthUser(std::string_view username, | ||
std::string_view password) const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment what the return value means (not obvious without looking at impl how to tell apart non-existing and existing but disabled user) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No needed anymore, we deep copy the username :) |
||
|
||
// Helper class for accessing the registry with a ReadLock outside the scope of UserRegistry | ||
class RegistryViewWithLock { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,6 +196,8 @@ class ConnectionContext : public facade::ConnectionContext { | |
// Reference to a FlowInfo for this connection if from a master to a replica. | ||
FlowInfo* replication_flow; | ||
|
||
std::optional<std::string_view> authed_username; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC, the underlying There's an issue in general of what happens to connections when their user is deleted. But this especially looks like a UAF bug waiting to happen. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope. That's not true.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, but please document this next to the field. |
||
|
||
private: | ||
void EnableMonitoring(bool enable) { | ||
subscriptions++; // required to support the monitoring | ||
|
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 is a bit silly, but do we want to check no category appears both as a minus and as a plus?
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 is from the previous PR. What do you mean
no
caregory? You meanNONE
?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.
like what happens if I do
ACL SETUSER +@JSON -@JSON
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.
So I thought about this before, and for this specific case there won't be an issue because the ADD set is applied Before the REMOVE set and I thought that this redundancy is fine. However, now I am thinking about it, for the reverse case this is not true, that is
-@JSON +@JSON
won't do what is expected and therefore I think we should only allow a group once perSET USER
command (and probably this will require some special handling for some categories, example is-@JSON +@ALL
).Another solution is to apply them one by one in order which is slightly slower (since I can apply them all at once) but I don't expect it will affect the performance and IMO I think this is a better solution since it covers the ordering and we can allow
+@JSON -@JSON
and vice versa.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.
I will address this in a separate PR since this is about the
AUTH
commandUh oh!
There was an error while loading. Please reload this page.
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.
Wait... What operations are permitted? If the string is SSO, then any operations on the map (rehashing, shrinking, etc) will invalidate the string_view 🤨
PS: I wanted to put this comment below the
std::optional<std::string_view> authed_username;
discussion 😬