-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Description
Description:
Email standard ignores difference between upper and lowercase letters in the email address format. (Case insensitive by design.)
However, Rocket.Chat email address attribute content is handled as case sensitive.
This causes issues when RC is supposed to merge two Oauth/OpenID accounts of the same user from two separate authentication sources. Those users who have their email address in both authentication sources exactly the same end up having one account, while those having one in upper and other in lowercase will have two separate accounts. (As long as the OpenID provided username is different, and it often is.)
Steps to reproduce:
- Create separate accounts on two Oauth/OpenID authentication sources: testuser and testuser2.
- In one authentication source set the email addess as test.user@example.com and in other Test.User@example.com.
- Log in to Rocket.Chat with both accounts in succession.
Expected behavior:
Only the first account testuser gets created. Logging in with the second account testuser2 should still get in, at least after the proper email verification. Accounts get merged, although the latter username gets embedded into the former in the database and is not visible to the user.
One user account for one real working email address makes user and channel management easier.
Actual behavior:
Merge does not happen. Rocket.Chat generates two visibly and in reality separate accounts for those users whose emails are not uniform:
testuser, email: test.user@example.com
testuser2, email: Test.User@example.com
Naturally those that get two separate user accounts in RC are handled completely separately by RC in channel membership selections etc. causing confusion.
Now, both behaviors would be ok; one merged account when emails are 1:1, or always two accounts. Latter would be ok only if it was predictably consistent. But they are not; some authentication sources allow users to type in the email addresses as they see fit (bad), some reformat them to lowercase in all situations (good), and others generate the email addresses directly from the givenname and surname, including their capitals (bad).
Because RC instance admin is not responsible for maintaining all possible federated authentication data sources of users, some of the users end up having one account in RC, and others get several, just because their email address format is not uniform across the board. (And I emphasize again that email standard itself handles all email addresses case insensitively regardless.)
Therefore I suggest that all email address attribute data should be converted to lowercase by RC itself, or at least they should be internally handled as lowercase.
Server Setup Information:
- Version of Rocket.Chat Server: 3.16.3
- Operating System: CentOS7
- Deployment Method: tar
- Number of Running Instances: 2
- DB Replicaset Oplog: Yes
- NodeJS Version: 12.22.1
- MongoDB Version: 4.0
Additional information:
From security point several accounts or one account for one email address does not cause an issue; one still cannot forge and seize accounts with wrong email addresses as long as accounts are email verified. User confirms they are in hold of the email address (and thus account) in the account creation process and that can always go only to one DNS MX email record owning recipient, no matter whether upper or lowercase email address was provided.