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

User names containing "-" from LDAP give 422 #11277

Closed
gerazo opened this issue Jul 10, 2019 · 5 comments
Closed

User names containing "-" from LDAP give 422 #11277

gerazo opened this issue Jul 10, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@gerazo
Copy link

gerazo commented Jul 10, 2019

Expected behaviour

User names containing hyphens ("-") are possible in connected systems using LDAP or other authentication. Mastodon should let all users (including those with hyphens in account name) authenticated by LDAP in.

Actual behaviour

If a user has "-" in the username and enters the password correctly, HTTP 422 error is returned. In case of incorrect password, the user is refused correctly.

Steps to reproduce the problem

Try to login with any user coming from LDAP auth and having hyphen in the username. We could try it with a brand new user, so nobody could ever login with a username like this before.

Specifications

v2.9.2

Probably related to:
Issue: #9066
Issue: #9309
PR: #9345

@gerazo gerazo changed the title User names containing "-" from LDAP give 422 User names containing "-" from LDAP gives 422 Jul 10, 2019
@gerazo gerazo changed the title User names containing "-" from LDAP gives 422 User names containing "-" from LDAP give 422 Jul 10, 2019
@tigre-bleu
Copy link

Seems related to #6830

@gerazo
Copy link
Author

gerazo commented Jul 12, 2019

Thanks @tigre-bleu According to what @Gargron said, there is a workaround by stripping or changing these problematic characters. But according to the bugs I've linked, hyphens were considered real bugs and those were fixed.
So my question is: Which way is the good way to go?
If the workaround is encouraged, where can I put such a regexp on usernames coming from other auth sources? (And would it really work also on auth? The user enters the real username and than gets an altered one also used for mentions?)

@tigre-bleu
Copy link

IMHO, the only solution is to separate authentification to LDAP using email, and username.

See the workflow I suggested in #6830: The user auths with LDAP using his email address and if it is the first time, he chooses a pseudo on the platform that shall respect the infamous regex that can't be changed.

Next logins he can either use is email to auth against LDAP, or use his pseudo. Mastodon then auths with LDAP by looking up for the email in its database.

If we don't want to bother too much, we could just allow to log via email and there is not the lookup functionnality to add.

@Gargron Gargron added the bug Something isn't working label Aug 5, 2019
@stale stale bot added the status/wontfix This will not be worked on label Oct 26, 2019
@nightpool nightpool removed the status/wontfix This will not be worked on label Apr 28, 2020
@mastodon mastodon deleted a comment from stale bot Apr 28, 2020
@SuperSandro2000
Copy link
Contributor

see #12021

Looks like you just need to set the LDAP_UID_CONVERSION_ENABLED=true env.

So this can be closed.

@gerazo
Copy link
Author

gerazo commented Jan 4, 2023

Thanks for the information.

@gerazo gerazo closed this as completed Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants