fixed-username-checks - #5503
Conversation
Signed-off-by: yashgoyal0110 <yg364550@gmail.com>
bf6b909 to
56aa882
Compare
There was a problem hiding this comment.
Pull request overview
This PR relaxes username validation so pre-created users can use email-style usernames for Dex SSO correlation.
Changes:
- Expands backend and frontend username validation from 3–16 chars to 3–254 chars.
- Allows digits as the first character and permits
. _ - @ +in usernames. - Updates user-facing validation/error text and API documentation examples.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
chaoscenter/authentication/pkg/utils/sanitizers.go |
Updates strict username regex and validator error text. |
chaoscenter/authentication/pkg/utils/errors.go |
Updates username policy violation description. |
chaoscenter/authentication/api/handlers/doc.go |
Updates API documentation example for username validation errors. |
chaoscenter/web/src/constants/validation.ts |
Updates frontend username regex. |
chaoscenter/web/src/views/CreateNewUser/CreateNewUser.tsx |
Raises UI username max length to 254. |
chaoscenter/web/src/strings/strings.en.yaml |
Updates username validation copy and reformats related strings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@yashgoyal0110 could you please review the comments by co-pilot? |
Signed-off-by: yashgoyal0110 <yg364550@gmail.com>
@PriteshKiri |
|
@yashgoyal0110, could you please fix the CI check in a different PR and link it here? |
|
Sure
Sure @PriteshKiri |
|
@yashgoyal0110, could you please ping me on the Kubernetes Slack workspace once the PR for the Trivy fix is up? Just in case I miss the GitHub notification. |
Ok, I will |
|
@PriteshKiri |
|
Hey @yashgoyal0110 |
sure! |
e8d2acf to
987fc86
Compare
987fc86 to
73b4873
Compare
Proposed changes
Fixes #5413
The auth API's username validator (
ValidateStrictUsername) enforced^[a-zA-Z][a-zA-Z0-9_-]{2,15}$— i.e., 3–16 chars, alphanumerics +_-only, must start with a letter. This made it impossible to pre-create a user whose username is their email address (e.g.john.smith.long@example.com), which is required to correlate Dex SSO logins with pre-created accounts. Dex setsUsername = claims.Emailin dex_auth_handler.go#L127, so any email longer than 16 characters or containing@/.was rejected by/create_userwith401 username_policy_violation.Files touched
chaoscenter/authentication/pkg/utils/sanitizers.gochaoscenter/authentication/pkg/utils/errors.gochaoscenter/authentication/api/handlers/doc.gochaoscenter/web/src/constants/validation.tschaoscenter/web/src/strings/strings.en.yamlchaoscenter/web/src/views/CreateNewUser/CreateNewUser.tsxTypes of changes
Checklist