Removing unnused InviteSalt config (#10446)

Этот коммит содержится в:
Jesús Espino
2019-03-15 07:06:28 +01:00
коммит произвёл GitHub
родитель 5dbf8aec7d
Коммит 921504483b
8 изменённых файлов: 0 добавлений и 32 удалений

Просмотреть файл

@@ -33,9 +33,6 @@ func TestGetConfig(t *testing.T) {
if *cfg.FileSettings.AmazonS3SecretAccessKey != model.FAKE_SETTING && len(*cfg.FileSettings.AmazonS3SecretAccessKey) != 0 {
t.Fatal("did not sanitize properly")
}
if *cfg.EmailSettings.InviteSalt != model.FAKE_SETTING {
t.Fatal("did not sanitize properly")
}
if *cfg.EmailSettings.SMTPPassword != model.FAKE_SETTING && len(*cfg.EmailSettings.SMTPPassword) != 0 {
t.Fatal("did not sanitize properly")
}

Просмотреть файл

@@ -96,7 +96,6 @@ func (cs *commonStore) load(f io.ReadCloser, needsSave bool, validate func(*mode
// such a change will be made before invoking.
needsSave = needsSave || loadedCfg.SqlSettings.AtRestEncryptKey == nil || len(*loadedCfg.SqlSettings.AtRestEncryptKey) == 0
needsSave = needsSave || loadedCfg.FileSettings.PublicLinkSalt == nil || len(*loadedCfg.FileSettings.PublicLinkSalt) == 0
needsSave = needsSave || loadedCfg.EmailSettings.InviteSalt == nil || len(*loadedCfg.EmailSettings.InviteSalt) == 0
loadedCfg.SetDefaults()

Просмотреть файл

@@ -26,9 +26,6 @@ func init() {
FileSettings: model.FileSettings{
PublicLinkSalt: sToP("abcdefghijklmnopqrstuvwxyz0123456789"),
},
EmailSettings: model.EmailSettings{
InviteSalt: sToP("abcdefghijklmnopqrstuvwxyz0123456789"),
},
LocalizationSettings: model.LocalizationSettings{
DefaultServerLocale: sToP("en"),
DefaultClientLocale: sToP("en"),
@@ -51,9 +48,6 @@ func init() {
Directory: sToP("/path/to/directory"),
PublicLinkSalt: sToP("abcdefghijklmnopqrstuvwxyz0123456789"),
},
EmailSettings: model.EmailSettings{
InviteSalt: sToP("abcdefghijklmnopqrstuvwxyz0123456789"),
},
LocalizationSettings: model.LocalizationSettings{
DefaultServerLocale: sToP("garbage"),
DefaultClientLocale: sToP("garbage"),

Просмотреть файл

@@ -191,7 +191,6 @@
"SMTPServer": "dockerhost",
"SMTPPort": "2500",
"ConnectionSecurity": "",
"InviteSalt": "",
"SendPushNotifications": true,
"PushNotificationServer": "https://push-test.mattermost.com",
"PushNotificationContents": "generic",

Просмотреть файл

@@ -24,9 +24,6 @@ func desanitize(actual, target *model.Config) {
target.FileSettings.AmazonS3SecretAccessKey = actual.FileSettings.AmazonS3SecretAccessKey
}
if *target.EmailSettings.InviteSalt == model.FAKE_SETTING {
target.EmailSettings.InviteSalt = actual.EmailSettings.InviteSalt
}
if *target.EmailSettings.SMTPPassword == model.FAKE_SETTING {
target.EmailSettings.SMTPPassword = actual.EmailSettings.SMTPPassword
}

Просмотреть файл

@@ -24,7 +24,6 @@ func TestDesanitize(t *testing.T) {
actual.LdapSettings.BindPassword = sToP("bind_password")
actual.FileSettings.PublicLinkSalt = sToP("public_link_salt")
actual.FileSettings.AmazonS3SecretAccessKey = sToP("amazon_s3_secret_access_key")
actual.EmailSettings.InviteSalt = sToP("invite_salt")
actual.EmailSettings.SMTPPassword = sToP("smtp_password")
actual.GitLabSettings.Secret = sToP("secret")
actual.SqlSettings.DataSource = sToP("data_source")
@@ -46,7 +45,6 @@ func TestDesanitize(t *testing.T) {
target.LdapSettings.BindPassword = sToP(model.FAKE_SETTING)
target.FileSettings.PublicLinkSalt = sToP(model.FAKE_SETTING)
target.FileSettings.AmazonS3SecretAccessKey = sToP(model.FAKE_SETTING)
target.EmailSettings.InviteSalt = sToP(model.FAKE_SETTING)
target.EmailSettings.SMTPPassword = sToP(model.FAKE_SETTING)
target.GitLabSettings.Secret = sToP(model.FAKE_SETTING)
target.SqlSettings.DataSource = sToP(model.FAKE_SETTING)
@@ -67,7 +65,6 @@ func TestDesanitize(t *testing.T) {
assert.Equal(t, *actual.LdapSettings.BindPassword, *target.LdapSettings.BindPassword)
assert.Equal(t, *actual.FileSettings.PublicLinkSalt, *target.FileSettings.PublicLinkSalt)
assert.Equal(t, *actual.FileSettings.AmazonS3SecretAccessKey, *target.FileSettings.AmazonS3SecretAccessKey)
assert.Equal(t, *actual.EmailSettings.InviteSalt, *target.EmailSettings.InviteSalt)
assert.Equal(t, *actual.EmailSettings.SMTPPassword, *target.EmailSettings.SMTPPassword)
assert.Equal(t, *actual.GitLabSettings.Secret, *target.GitLabSettings.Secret)
assert.Equal(t, *actual.SqlSettings.DataSource, *target.SqlSettings.DataSource)

Просмотреть файл

@@ -1053,7 +1053,6 @@ type EmailSettings struct {
SMTPServer *string
SMTPPort *string
ConnectionSecurity *string
InviteSalt *string
SendPushNotifications *bool
PushNotificationServer *string
PushNotificationContents *string
@@ -1137,10 +1136,6 @@ func (s *EmailSettings) SetDefaults() {
s.ConnectionSecurity = NewString(CONN_SECURITY_NONE)
}
if s.InviteSalt == nil || len(*s.InviteSalt) == 0 {
s.InviteSalt = NewString(NewRandomString(32))
}
if s.SendPushNotifications == nil {
s.SendPushNotifications = NewBool(false)
}
@@ -2478,10 +2473,6 @@ func (es *EmailSettings) isValid() *AppError {
return NewAppError("Config.IsValid", "model.config.is_valid.email_security.app_error", nil, "", http.StatusBadRequest)
}
if len(*es.InviteSalt) < 32 {
return NewAppError("Config.IsValid", "model.config.is_valid.email_salt.app_error", nil, "", http.StatusBadRequest)
}
if *es.EmailBatchingBufferSize <= 0 {
return NewAppError("Config.IsValid", "model.config.is_valid.email_batching_buffer_size.app_error", nil, "", http.StatusBadRequest)
}
@@ -2842,11 +2833,6 @@ func (o *Config) Sanitize() {
*o.FileSettings.AmazonS3SecretAccessKey = FAKE_SETTING
}
*o.EmailSettings.InviteSalt = FAKE_SETTING
if len(*o.EmailSettings.SMTPPassword) > 0 {
*o.EmailSettings.SMTPPassword = FAKE_SETTING
}
if len(*o.GitLabSettings.Secret) > 0 {
*o.GitLabSettings.Secret = FAKE_SETTING
}

Просмотреть файл

@@ -172,7 +172,6 @@
"SMTPServer": "dockerhost",
"SMTPPort": "2500",
"ConnectionSecurity": "",
"InviteSalt": "n3mceqsek4j5ichs5hw9sudwx3cfbtqa",
"SendPushNotifications": false,
"PushNotificationServer": "",
"PushNotificationContents": "generic",