mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-27525: Sanitizes gifycat's and Oauth secrets. (#15348)
This commit is contained in:
@@ -33,6 +33,14 @@ func desanitize(actual, target *model.Config) {
|
||||
target.GitLabSettings.Secret = actual.GitLabSettings.Secret
|
||||
}
|
||||
|
||||
if target.GoogleSettings.Secret != nil && *target.GoogleSettings.Secret == model.FAKE_SETTING {
|
||||
target.GoogleSettings.Secret = actual.GoogleSettings.Secret
|
||||
}
|
||||
|
||||
if target.Office365Settings.Secret != nil && *target.Office365Settings.Secret == model.FAKE_SETTING {
|
||||
target.Office365Settings.Secret = actual.Office365Settings.Secret
|
||||
}
|
||||
|
||||
if *target.SqlSettings.DataSource == model.FAKE_SETTING {
|
||||
*target.SqlSettings.DataSource = *actual.SqlSettings.DataSource
|
||||
}
|
||||
@@ -57,6 +65,10 @@ func desanitize(actual, target *model.Config) {
|
||||
if *target.MessageExportSettings.GlobalRelaySettings.SmtpPassword == model.FAKE_SETTING {
|
||||
*target.MessageExportSettings.GlobalRelaySettings.SmtpPassword = *actual.MessageExportSettings.GlobalRelaySettings.SmtpPassword
|
||||
}
|
||||
|
||||
if target.ServiceSettings.GfycatApiSecret != nil && *target.ServiceSettings.GfycatApiSecret == model.FAKE_SETTING {
|
||||
*target.ServiceSettings.GfycatApiSecret = *actual.ServiceSettings.GfycatApiSecret
|
||||
}
|
||||
}
|
||||
|
||||
// fixConfig patches invalid or missing data in the configuration, returning true if changed.
|
||||
|
||||
@@ -3504,6 +3504,14 @@ func (o *Config) Sanitize() {
|
||||
*o.GitLabSettings.Secret = FAKE_SETTING
|
||||
}
|
||||
|
||||
if o.GoogleSettings.Secret != nil && len(*o.GoogleSettings.Secret) > 0 {
|
||||
*o.GoogleSettings.Secret = FAKE_SETTING
|
||||
}
|
||||
|
||||
if o.Office365Settings.Secret != nil && len(*o.Office365Settings.Secret) > 0 {
|
||||
*o.Office365Settings.Secret = FAKE_SETTING
|
||||
}
|
||||
|
||||
*o.SqlSettings.DataSource = FAKE_SETTING
|
||||
*o.SqlSettings.AtRestEncryptKey = FAKE_SETTING
|
||||
|
||||
@@ -3520,4 +3528,8 @@ func (o *Config) Sanitize() {
|
||||
if o.MessageExportSettings.GlobalRelaySettings.SmtpPassword != nil && len(*o.MessageExportSettings.GlobalRelaySettings.SmtpPassword) > 0 {
|
||||
*o.MessageExportSettings.GlobalRelaySettings.SmtpPassword = FAKE_SETTING
|
||||
}
|
||||
|
||||
if o.ServiceSettings.GfycatApiSecret != nil && len(*o.ServiceSettings.GfycatApiSecret) > 0 {
|
||||
*o.ServiceSettings.GfycatApiSecret = FAKE_SETTING
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user