Closed JianMinTang closed 3 days ago
Hey @JianMinTang @Vad1mo @bupd,
I would like to work on this issue. I am thinking of adding the following symbols to the username validation pattern:
.
): Allows separation of words for better readability and supports email-like usernames._
): Widely used to enhance clarity and readability without introducing ambiguity.-
): Links multiple words, improving visual structure while maintaining compatibility with URLs and CLI.Additionally, I propose enforcing a rule that disallows consecutive symbols in usernames. Valid usernames will start and end with alphanumeric characters and may have symbols in between, ensuring that patterns like abc--bacd
are rejected, while formats like xyz.symbol.abc
are accepted.
Hey @JianMinTang @Vad1mo @bupd,
I would like to work on this issue. I am thinking of adding the following symbols to the username validation pattern:
Period (
.
): Allows separation of words for better readability and supports email-like usernames.Underscore (
_
): Widely used to enhance clarity and readability without introducing ambiguity.Hyphen (
-
): Links multiple words, improving visual structure while maintaining compatibility with URLs and CLI.Additionally, I propose enforcing a rule that disallows consecutive symbols in usernames. Valid usernames will start and end with alphanumeric characters and may have symbols in between, ensuring that patterns like
abc--bacd
are rejected, while formats likexyz.symbol.abc
are accepted.
The rules on the CLI should simply match with the rules on Harbor Server side.
Hey @JianMinTang @Vad1mo @bupd, I would like to work on this issue. I am thinking of adding the following symbols to the username validation pattern:
- Period (
.
): Allows separation of words for better readability and supports email-like usernames.- Underscore (
_
): Widely used to enhance clarity and readability without introducing ambiguity.- Hyphen (
-
): Links multiple words, improving visual structure while maintaining compatibility with URLs and CLI.Additionally, I propose enforcing a rule that disallows consecutive symbols in usernames. Valid usernames will start and end with alphanumeric characters and may have symbols in between, ensuring that patterns like
abc--bacd
are rejected, while formats likexyz.symbol.abc
are accepted.The rules on the CLI should simply match with the rules on Harbor Server side.
To align with this, the current server-side username validation logic uses a function to detect illegal characters. You can check the relevant code here. It references an illegal character list in the constants file here. We can implement a similar validation function to ensure consistency across the CLI and server.
Exactly
@Vad1mo I have submitted a PR to address this issue. Could you please take a look at it? Thank you!
the user requirements:
the ValidateUserName funtion
the username for testing:
We need to standardize these validation requirements, eg
harbor-cli
can't work on thisValidationUserName
function. @Vad1mo @bupd