feat: TOOLS-3053 implement role name validation in ManageACLCreateRoleController #357
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Role Name Validation Enhancement
Description
Added validation for role names to ensure they only contain allowed characters. This helps prevent potential issues with invalid role names in the system.
Changes
is_valid_role_name()function inlib/utils/util.pythat validates role names against a regex patterntest/unit/utils/test_util.pyValidation Rules
A valid role name can only contain:
Test Coverage
Added test cases for:
Impact
This change helps maintain data integrity by ensuring role names follow the correct format before they are used in the system.
Note
I have added this change to manage acl
create rolecommand and not other commands likegrant roleorcreate user grant roles, where it should be assumed that the role is already present. It requires enforcement from Server.