Ban use of `current_application_settings` when reading settings
Problem
We use Gitlab::CurrentSettings.current_application_settings everywhere in the codebase. This is bad because it returns an ActiveRecord object that can be modified. We should ban the use of Gitlab::CurrentSettings.current_application_settings and ApplicationSetting.current* methods and instead read the attribute directly, relying on method_missing implementation.
Proposal
- Introduce a Rubocop Cop that flags any use of
Gitlab::CurrentSettings.current_application_settingsandApplicationSetting.current*methods - Remove all code paths that are not admin workflows where we return
ApplicationSettingrecord, so that we don't leak it anywhere. At the very minimum the AR object returned should be set asreadonly!.
Edited by Fabio Pitino - PTO until Jan 1