[LDAP-Authentication] Special Characters #2048

Closed
opened 2025-11-02 04:22:18 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @neurolag on GitHub (Jul 12, 2018).

  • Gitea version (or commit ref): c784ac5
  • Git version: 2.7.4
  • Operating system: Linux 4.4.0-042stab130.1 #1 SMP Tue May 22 09:19:34 MSK 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL MariaDB
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log:
2018/07/12 13:13:30 [W] Failed to login '~Tutti~' via 'RomHackersWorld': Invalid pattern for attribute 'username' [~Tutti~]: must be valid alpha or numeric or dash(-_) or dot characters

https://github.com/go-gitea/gitea/blob/master/models/login_source.go#L405-L407

Description

Some members of our community (our community-leader, for example) have special characters in their username which natively is supported by LDAP and also gitea.
His username, for example, is ~Tutti~.

When logging in a strange error message appears (see screenshot below).
The user isn't migrated and is unable to log in.

I think the way to check the username when logging in via LDAP should be changed a little.
Thanks for the support in advance

Screenshots

image

Originally created by @neurolag on GitHub (Jul 12, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): c784ac5 - Git version: 2.7.4 - Operating system: `Linux 4.4.0-042stab130.1 #1 SMP Tue May 22 09:19:34 MSK 2018 x86_64 x86_64 x86_64 GNU/Linux` - Database (use `[x]`): - [ ] PostgreSQL - [x] ~~MySQL~~ MariaDB - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log: ``` 2018/07/12 13:13:30 [W] Failed to login '~Tutti~' via 'RomHackersWorld': Invalid pattern for attribute 'username' [~Tutti~]: must be valid alpha or numeric or dash(-_) or dot characters ``` https://github.com/go-gitea/gitea/blob/master/models/login_source.go#L405-L407 ## Description Some members of our community (our community-leader, for example) have special characters in their username which natively is supported by LDAP and also gitea. His username, for example, is `~Tutti~`. When logging in a strange error message appears (see screenshot below). The user isn't migrated and is unable to log in. I think the way to check the username when logging in via LDAP should be changed a little. Thanks for the support in advance ## Screenshots ![image](https://user-images.githubusercontent.com/7085564/42632047-439b8a7c-85dc-11e8-8077-9a7b7e0232c4.png) <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/enhancementissue/stale labels 2025-11-02 04:22:18 -06:00
Author
Owner

@SBird1337 commented on GitHub (Jul 19, 2018):

I can confirm that users with, as far as I can tell, non-alphanumeric characters in their username cannot be migrated from LDAP to Gitea (In fact can't even get past the Gitea Authentication Module)

Since both Gitea and LDAP support more than alphanumeric characters I don't think it is intended that the Gitea LDAP Module does not.

@SBird1337 commented on GitHub (Jul 19, 2018): I can confirm that users with, as far as I can tell, non-alphanumeric characters in their username cannot be migrated from LDAP to Gitea (In fact can't even get past the Gitea Authentication Module) Since both Gitea and LDAP support more than alphanumeric characters I don't think it is intended that the Gitea LDAP Module does not.
Author
Owner

@HoffmannP commented on GitHub (Sep 19, 2018):

Our University does not have any unique special-char-free speaking names in it's Active Directory. I hence have to use the non-speaking cryptic username alika X4NA4P. It's would be nice if gitea would just filter illegal characters at least as a workaround (eg. "Peter Hoffmann" -> "Peter_Hoffmann" oder "PeterHoffmann" or what ever).
Would a pull request adding this functionality be accepted?

@HoffmannP commented on GitHub (Sep 19, 2018): Our University does not have any unique special-char-free speaking names in it's Active Directory. I hence have to use the non-speaking cryptic username alika X4NA4P. It's would be nice if gitea would just filter illegal characters at least as a workaround (eg. "Peter Hoffmann" -> "Peter_Hoffmann" oder "PeterHoffmann" or what ever). Would a pull request adding this functionality be accepted?
Author
Owner

@stale[bot] commented on GitHub (Jan 8, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 8, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Feb 22, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Feb 22, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Author
Owner

@neurolag commented on GitHub (Feb 22, 2019):

This issue still persists.
Please reopen this issue.

@neurolag commented on GitHub (Feb 22, 2019): This issue still persists. Please reopen this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2048