Gitea rejects usernames from LDAP which contain ".-" #13198

Open
opened 2025-11-02 10:34:39 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @matrss on GitHub (Jun 24, 2024).

Description

The central AD instance in our organization provides usernames that contain ".-" for people with e.g. hyphenated first names. This is outside of my control. In the past, Gitea allowed these usernames, but since some point (#20136 I'd guess) this is no longer the case.

Since I am not able to change what is given to me as a username this means that people with these names are currently unable to login for the first time (i.e. when they don't have an account yet).

While there is probably some merit to the enforced rules on usernames, I think there should be an option to overrule those specifically for external authentication sources. Alternatively, there should be some mechanism to convert the provided usernames into something Gitea accepts, automatically.

Gitea Version

v1.20.5 (yes, outdated, working on it)

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker compose

Database

PostgreSQL

Originally created by @matrss on GitHub (Jun 24, 2024). ### Description The central AD instance in our organization provides usernames that contain ".-" for people with e.g. hyphenated first names. This is outside of my control. In the past, Gitea allowed these usernames, but since some point (#20136 I'd guess) this is no longer the case. Since I am not able to change what is given to me as a username this means that people with these names are currently unable to login for the first time (i.e. when they don't have an account yet). While there is probably some merit to the enforced rules on usernames, I think there should be an option to overrule those specifically for external authentication sources. Alternatively, there should be some mechanism to convert the provided usernames into something Gitea accepts, automatically. ### Gitea Version v1.20.5 (yes, outdated, working on it) ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? docker compose ### Database PostgreSQL
GiteaMirror added the topic/authenticationtype/bug labels 2025-11-02 10:34:39 -06:00
Author
Owner

@silverwind commented on GitHub (Jun 24, 2024):

We should continue enforce the usernames to be compatible with other forges, but for such auto-generated users from OAuth or LDAP, I could see adding a mechanism that tries to removes invalid characters from the username and if the name is available, use that.

For example if try I create a org foo.-baz on GitHub UI, it would create it as foo-baz.

@silverwind commented on GitHub (Jun 24, 2024): We should continue enforce the usernames to be compatible with other forges, but for such auto-generated users from OAuth or LDAP, I could see adding a mechanism that tries to removes invalid characters from the username and if the name is available, use that. For example if try I create a org `foo.-baz` on GitHub UI, it would create it as `foo-baz`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13198