Skip to content

RANGER-5534: added validation logic for username and groupname for usersync process#903

Open
sneethiraj wants to merge 3 commits intoapache:masterfrom
sneethiraj:RANGER-5534
Open

RANGER-5534: added validation logic for username and groupname for usersync process#903
sneethiraj wants to merge 3 commits intoapache:masterfrom
sneethiraj:RANGER-5534

Conversation

@sneethiraj
Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

  • Added username and groupname validation based on regEx
  • Configuration - userName validation enabled [true/false]
  • Configuration - groupName validation enabled [true/false]
  • Configuration - RegEx for the username validation [default: "^[a-z_][a-z0-9_-]{0,31}$" ]
  • Configuration - RegEx for the groupname validation [default: "^[a-z][a-z0-9-]{0,30}$" ]

How was this patch tested?

Tested locally on Mac


if (validateUserName) {
if (!isValidUserName(userName)) {
LOG.warn("Ignoring Unix Username: [{}]: failed to confirm to validation-pattern: [{}]", userName, regExUserNameValidator);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneethiraj - this could result in usernames having valid non-English characters (accent characters, CJK character sets) to be skipped with default configuration. This can break environments already have such user names and group names.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. We can implement the following regex validations that supports international char sets:

    private static final String DEFAULT_REGEX_USERNAME_VALIDATOR = "^[\\p{L}\\p{Mn}\\p{Nd}\\._-]{3,64}$" ;
    private static final String DEFAULT_REGEX_GROUPNAME_VALIDATOR = "^[\\p{L}\\p{N}._\\-\\s]{1,256}$"    ;

However, we need to document this as part of the upgrade to 2.8.1+ release that the username and groupname validations are defaulted to be ON with specific regex and customers are requested to review and modify if needed before deploying newer version of code.

Can you share your thoughts on the best approach to resolve this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already fixed this issue as part of RANGER-5508 please check this fix and do let me know if it is completely different issue.

@apache apache deleted a comment from vyommani Apr 1, 2026
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.

3 participants