Errors when using the API to set application settings - import_sources, password_authentication
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=31409) </details> <!--IssueSummary end--> <!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label. For the Community Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=bug For the Enterprise Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary When trying to set all settings at once using [the API](https://docs.gitlab.com/ee/api/settings.html#change-application-settings), there are two errors thrown for the default settings (default, as in, exported from a fresh install): ``` {"error":"import_sources does not have a valid value, password_authentication_enabled_for_web, password_authentication_enabled, signin_enabled are mutually exclusive"} ``` ### Steps to reproduce 1. Fresh install of latest version of GitLab (12.2.3 at the moment of reproducing this) 2. Create a Personal Access Token 3. Save the application settings JSON response from the API: ``` curl -H "PRIVATE-TOKEN: token" http://host/api/v4/application/settings > settings.json ``` 4. Attempt to PUT back the JSON through the API: ``` curl -H "PRIVATE-TOKEN: token" -X PUT -d @settings.json -H "Content-Type: application/json" http://host/api/v4/application/settings ``` ### Example Project N/A ### What is the current *bug* behavior? An error is thrown because of two invalid field validations: `import_sources` in [line 77, the api/settings file](https://gitlab.com/gitlab-org/gitlab-ce/blob/12-2-stable/lib/api/settings.rb#L77) and the `mutually_exclusive` check on `password_authentication_enabled_for_web, password_authentication_enabled, signin_enabled` in [line 94, the api/settings file](https://gitlab.com/gitlab-org/gitlab-ce/blob/12-2-stable/lib/api/settings.rb#L94) ### What is the expected *correct* behavior? The settings should be applied without errors. ### Relevant logs and/or screenshots ``` {"error":"import_sources does not have a valid value, password_authentication_enabled_for_web, password_authentication_enabled, signin_enabled are mutually exclusive"} ``` ### Possible fixes For the `import_sources` error, it looks like [the validated array](https://gitlab.com/gitlab-org/gitlab-ce/blob/12-2-stable/lib/api/settings.rb#L77) is not up to date so it's likely just updating with the correct values here; but I don't know the context for the other error about the `mutually_exclusive` check on `password_authentication_enabled_for_web, password_authentication_enabled, signin_enabled`.
issue