Skip to content

Fix LDAP config `sync_name` problem

What does this MR do and why?

Fixes problem in !110628 (merged) and reported later via OAuth and OmniAuth login stopped working after ... (#392952 - closed), if we didn't enable the LDAP feature, we will meet the error "Missing setting 'sync_name' in 'ldap' section" when login in through OAuth(GitLab/GitHub).

We initialized the config sync_name under the LDAP feature enabled: https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/initializers/1_settings.rb#L29, but
it can be used in the LDAP feature-disabled scenario: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/user_synced_attributes_metadata.rb#L38.

Screenshots or screen recordings

How to set up and validate locally

  1. Start a GDK environment
  2. Disable the LDAP feature:
    Gitlab.config.ldap.enable = false
  3. Visit the login page and use the OAuth login by Gitlab.com or GitHub.com.
  4. After the fix, we will never see the error.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

/cc @chaomao @daveliu

Edited by Adil Farrukh

Merge request reports