Skip to content

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

Merged
merged 1 commit into from
Jul 15, 2025

Conversation

hedgieinsocks
Copy link
Contributor

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.

@mmontes11 mmontes11 self-requested a review July 14, 2025 08:05
Copy link
Member

@mmontes11 mmontes11 left a 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.

@hedgieinsocks hedgieinsocks force-pushed the mutable_grants branch 2 times, most recently from 75b3d15 to c22205f Compare July 15, 2025 09:51
@mmontes11 mmontes11 self-requested a review July 15, 2025 14:54
Copy link
Member

@mmontes11 mmontes11 left a 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.

@hedgieinsocks hedgieinsocks force-pushed the mutable_grants branch 2 times, most recently from 4492d8f to 978191e Compare July 15, 2025 15:50
@mmontes11 mmontes11 self-requested a review July 15, 2025 16:07
Copy link
Member

@mmontes11 mmontes11 left a 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

@mmontes11 mmontes11 self-requested a review July 15, 2025 16:53
Copy link
Member

@mmontes11 mmontes11 left a 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! 🙏🏻

@mmontes11 mmontes11 merged commit c9c4f5c into mariadb-operator:main Jul 15, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy