-
Notifications
You must be signed in to change notification settings - Fork 138
Make grant privileges mutable #1326
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
Conversation
433551d
to
00fd796
Compare
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.
Thanks for raising this @hedgieinsocks ! Useful feature that users have mentioned long time ago.
I think we should track the existing privileges in the status and revoke them more granularly, as you suggested. Left a couple of observations in the implementation.
Related to #1176.
75b3d15
to
c22205f
Compare
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.
LGTM! Works like a charm, congrats!
I've left my nitpicky suggestion as usual. Happy to merge after addressing it.
4492d8f
to
978191e
Compare
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.
Please take a look at my comment
978191e
to
a4b910e
Compare
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.
LGTM! Thank you very much for this initiative! 🙏🏻
Since MariaDB does not yet support https://jira.mariadb.org/browse/MDEV-17476 we need another way to limit disk usage abusers, e.g. to edit grant permissions on the fly to allow only selecting until the abuser agrees to take action.
However, since privileges are immutable, one will have to delete the grant resource. And if the grant resource is controlled by a custom operator, then uh-oh bad luck.
Luckily, it seems we can easily track last applied privileges in the status, and revoke the ones that are no longer present in the spec declaration.
I revoke only those privileges that are no longer needed. But we can make it simpler if need be and blindly remove the whole set, the ones we still need will be reapplied anyway the next moment.
Or we can refactor revoke sql completely and like mentioned in #1176 just run
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user;
to nuke it.