Skip to content

Add numeric username support #179

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tustunkok
Copy link

Synapse does not accept numeric usernames since they are reserved for the guest account. If a unique LDAP attribute is chosen while signing in, Synapse returns an error and LDAP module says invalid username or password. This patch handles numeric only usernames by adding an uppercase "U" in the beginning of the numeric username (returned from LDAP uid attribute).

This pull request is related with the issue #55.

@tustunkok tustunkok requested a review from a team as a code owner April 24, 2023 16:05
Comment on lines +126 to +129
if username.isnumeric():
localpart = f"U{username}"
else:
localpart = username
Copy link
Member

Choose a reason for hiding this comment

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

I think this implies conflicts if you have both 1234 and U1234 as unique usernames in your system?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that is correct. I cannot imagine how to solve this problem at this time.

Copy link
Member

Choose a reason for hiding this comment

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

My initial thought would be to add a configuration prefix or something that gets added to all usernames. (Or do something similar to the mapping that the SSO providers do.)

Copy link
Author

Choose a reason for hiding this comment

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

This can do the trick. Also, I will add one more change to overcome a bug while getting encryption keys. When you try to download backup keys, it asks for the password. Even if you enter it correctly, synapse says it is invallid. This is because the module tries to send the username with the prefix, however there is no match in LDAP for the username with prefix. I had also fixed this problem and will publish another change.

@ideafarm
Copy link

ideafarm commented Dec 4, 2024

Why not fix the root cause of the problem by prefix all guest account usernames with some reserved string such as "synguest."? I have a significant reason for wanting to use numeric usernames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants