You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "JohnYuu (via GitHub)" <gi...@apache.org> on 2023/02/03 12:05:36 UTC

[GitHub] [dolphinscheduler] JohnYuu commented on a diff in pull request #13506: improve linux username pattern

JohnYuu commented on code in PR #13506:
URL: https://github.com/apache/dolphinscheduler/pull/13506#discussion_r1095728773


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/RegexUtils.java:
##########
@@ -26,7 +26,7 @@
  */
 public class RegexUtils {
 
-    private static final Pattern LINUX_USERNAME_PATTERN = Pattern.compile("^[a-zA-Z0-9_].{0,30}");
+    private static final Pattern LINUX_USERNAME_PATTERN = Pattern.compile("[a-zA-Z_][a-zA-Z\\d_-]{0,30}");

Review Comment:
   Not a good pattern, because only one '-'  also matches, but only one '-' is not a valid linux user name.
   Also, pure numbers also matches [a-zA-Z\\d_-].{0,30},  pure numbers are not valid linux user names.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org