Skip to content

LDAP user account ending with special characters causes issues at login

Summary

Customer reported having issues with users account creation due to a limitation on their LDAP provider that leaves accounts with - at the end of the username. This throws the error "Username must not start or end with a special character and must not contain consecutive special characters..

This only started happening after they upgraded to 16.5

Steps to reproduce

Example Project

What is the current bug behavior?

User gets error "Username must not start or end with a special character and must not contain consecutive special characters" when the account ends with -

What is the expected correct behavior?

Usernames should not be limited by special characters.

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Keep the feature flag available for customers to disable this change.

Proposal

Clean up the prefixed/suffixed - in uspect we should do that as part of this clean_path call. I think the actual work is done in Gitlab::Slug::Path

Edited by Adil Farrukh