-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support for creating and setting custom (Module based) ACL Categories using existing Module APIs #96
Comments
Hi - I'd like to start working on this. Can this issue be assigned to me? There are a few approaches to add this functionality to the SDK. I'll make a follow up comment detailing those ways once I've gone over them a bit more. |
Option 1High Level: In the modules we will make the developer of that set acl categories explicitly by calling a function that does the AddAclCategory function once. Followed by the setCommandACLCategories for each command. Will create two functions in Context called add_acl_category and set_acl_category. The add_acl_category will take in a string (The acl category name) and call ValkeyModule_AddACLCategory. While the set_acl_category will take in a string of the command name and another string (The acl category name). The command name will then be used in a get command which is then used in the SetCommandACLCategories. Example Usage:
APIs / Interface:
Pros:
Cons:
Option 2High Level: Update CommandInfo Struct to include acl_categories as a component, will cause a breaking change for modules as there will now be an incorrect number of args. Will also update the valkey_module macro to include a new field called acl categories where all the custom acl categories can be added, while also adding the field to the commands component of the macro where you can actually decide which commands get the acl categories or not. Example Usage:
APIs / Interface:
Pros:
Cons:
Overall for both: |
So this can also be used to add commands to existing categories such as But this will only work on Valkey or Redis 7.2 or greater. Can you wrap it in |
For compatibility we will check the min compatibility of the APIs and use the correct one for this feature Do you have a recommendation for either option 1 or 2? |
We have the following ACL Module APIs in the core:
Adding support for these existing APIs as wrapper functions (or macros) in the valkeymodule-rs SDK will allow modules to create their own customer ACL category and set this category on the module commands.
Example C Module which uses the APIs above: https://github.com/valkey-io/valkey/blob/4593dc2f059661e1c4eb43bba025f68948344228/tests/modules/aclcheck.c#L305-L313
The text was updated successfully, but these errors were encountered: