Skip to content
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

Merged
merged 10 commits into from
Aug 21, 2024

Conversation

ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Jul 8, 2024

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

Copy link
Contributor

dionisio-bot bot commented Jul 8, 2024

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Jul 8, 2024

🦋 Changeset detected

Latest commit: a56bc19

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 34 packages
Name Type
@rocket.chat/web-ui-registration Patch
@rocket.chat/i18n Patch
@rocket.chat/meteor Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/ui-client Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/model-typings Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/instance-status Patch

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

@ricardogarim ricardogarim changed the title fix: create validateUsername method fix: validate username before registering user Jul 8, 2024
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.43%. Comparing base (1e1e849) to head (a56bc19).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           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           
Flag Coverage Δ
unit 76.04% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ricardogarim ricardogarim force-pushed the fix/validate-username-on-users-register branch from f8245ce to 335e9b2 Compare July 8, 2024 14:36
@ricardogarim ricardogarim marked this pull request as ready for review July 8, 2024 16:51
@ricardogarim ricardogarim requested a review from a team as a code owner July 8, 2024 16:51
Copy link
Member

@MarcosSpessatto MarcosSpessatto left a 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.

@ggazzo ggazzo added this to the 6.12 milestone Aug 1, 2024
Copy link
Contributor

@KevLehman KevLehman left a comment

Choose a reason for hiding this comment

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

add a changeset

@jessicaschelly jessicaschelly added the stat: QA assured Means it has been tested and approved by a company insider label Aug 21, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Aug 21, 2024
@kodiakhq kodiakhq bot merged commit dd37ea1 into develop Aug 21, 2024
49 checks passed
@kodiakhq kodiakhq bot deleted the fix/validate-username-on-users-register branch August 21, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants