-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: validate username before registering user #32743
Conversation
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: a56bc19 The changes in this PR will be included in the next version bump. This PR includes changesets to release 34 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #32743 +/- ##
========================================
Coverage 59.43% 59.43%
========================================
Files 2546 2547 +1
Lines 63257 63265 +8
Branches 14236 14237 +1
========================================
+ Hits 37596 37604 +8
Misses 22941 22941
Partials 2720 2720
Flags with carried forward coverage won't be shown. Click here to find out more. |
f8245ce
to
335e9b2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are more places that require this change to be applied (or at least reviewed)...
https://github.com/RocketChat/Rocket.Chat/blob/develop/apps/meteor/server/methods/registerUser.ts#L31 is one of them, but I think we should revisit all the places where users are being created, like LDAP, SAML, admin panel, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a changeset
As per CORE-544 and as discussed internally at #rocketchat-dev, creating a new user with an invalid username (containing special characters) results in an error message, but the user is still created. This leads to an error when attempting to register again using the same email, as it is already registered.
To address this issue, I introduced a new method to validate usernames before registering users, ensuring that invalid usernames prevent user creation.
Screen.Recording.2024-07-08.at.08.57.04.mov