-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: per-user authentication plugin framework #5290
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
base: v3.0
Are you sure you want to change the base?
Conversation
Adds a new per-user auth plugin system that allows different users to authenticate using different methods via the auth_plugin attribute in mysql_users.attributes. Includes: - ProxySQL_Auth_Plugin interface (include/MySQL_AuthPlugin.h) - Plugin loading via auth_plugins config (src/main.cpp) - AUTH_SWITCH flow for clear-text credential (lib/MySQL_Protocol.cpp) - Static auth plugin as reference implementation - Integration tests and documentation
Validates K8s ServiceAccount JWT tokens via TokenReview API. Username format: namespace/serviceaccount (must match token identity). Features: - Direct TokenReview API integration (no external validator) - Configurable timeout via K8S_TIMEOUT_MS env var - Dependency injection for testability - 24 unit tests with mock K8s client
Summary of ChangesHello @rophy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a flexible and extensible per-user authentication plugin framework for ProxySQL. It allows administrators to configure diverse authentication mechanisms for individual users, moving beyond traditional password-based methods. This is particularly beneficial for integrating with modern identity providers and orchestrators like Kubernetes, enabling more secure and dynamic credential management without modifying ProxySQL's core logic. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This PR introduces a powerful and flexible per-user authentication plugin framework. The design is well-thought-out, with a clear interface for plugins, good separation of concerns (e.g., using dependency injection for the Kubernetes client), and comprehensive documentation and tests. The inclusion of both a simple static plugin and a more complex k8s plugin serves as a great reference for future plugin developers.
I have one major concern regarding the connection counting logic when both this new plugin framework and the existing LDAP plugin are used concurrently. I've provided detailed comments and suggestions in lib/MySQL_Session.cpp to address this.
Overall, this is an excellent feature addition to ProxySQL.
|
Hi, nowadays many apps and DBs are deployed inside Kubernetes. I am exploring possibilities to leverage Kubernetes ServiceAccount - a form of system identity defined and managed by Kubernetes, to enable passwordless authentication of MariaDB: https://github.com/rophy/mariadb-auth-k8s As a bonus, I think it might be useful for proxysql to support this as well, so I tried to mimic the concepts of existing proxysql LDAP auth support into a generic auth plugin framework. Wanted to know if proxysql team is interested in such idea. Disclaimer: Code is AI generated. I as human oversee the design, reviewed the test cases, and made sure the test cases pass in local dev container and local kubernetes cluster (kind). |
When both LDAP module and per-user auth plugins are configured, auth plugin users were incorrectly having their connections counted by LDAP's counter instead of GloMyAuth. Add use_auth_plugin flag to distinguish auth plugin users from LDAP users, ensuring correct connection counting regardless of whether LDAP module is loaded.
Replace strlen(s) == 0 with s[0] == '\0' to avoid potential issues with non-null-terminated strings and satisfy static analysis checks.
|
|
retest this please |
The PR involves building plugins (.so) so your existing CI pipeline will definitely fail. If OK, I'd also like to propose a common local-first build & test environment, to help external contributers have more consistent test results with proxysql team: #5292 |


Summary
Adds per-user auth plugin support via
mysql_users.attributes:Included Plugins
Tests
Docs