Removing password reset salt (#6334)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
fe95276ba8
Коммит
010ec23af3
@@ -81,9 +81,6 @@ func TestGetConfig(t *testing.T) {
|
|||||||
if cfg.EmailSettings.InviteSalt != model.FAKE_SETTING {
|
if cfg.EmailSettings.InviteSalt != model.FAKE_SETTING {
|
||||||
t.Fatal("did not sanitize properly")
|
t.Fatal("did not sanitize properly")
|
||||||
}
|
}
|
||||||
if cfg.EmailSettings.PasswordResetSalt != model.FAKE_SETTING {
|
|
||||||
t.Fatal("did not sanitize properly")
|
|
||||||
}
|
|
||||||
if cfg.EmailSettings.SMTPPassword != model.FAKE_SETTING && len(cfg.EmailSettings.SMTPPassword) != 0 {
|
if cfg.EmailSettings.SMTPPassword != model.FAKE_SETTING && len(cfg.EmailSettings.SMTPPassword) != 0 {
|
||||||
t.Fatal("did not sanitize properly")
|
t.Fatal("did not sanitize properly")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,9 +49,6 @@ func TestGetConfig(t *testing.T) {
|
|||||||
if cfg.EmailSettings.InviteSalt != model.FAKE_SETTING {
|
if cfg.EmailSettings.InviteSalt != model.FAKE_SETTING {
|
||||||
t.Fatal("did not sanitize properly")
|
t.Fatal("did not sanitize properly")
|
||||||
}
|
}
|
||||||
if cfg.EmailSettings.PasswordResetSalt != model.FAKE_SETTING {
|
|
||||||
t.Fatal("did not sanitize properly")
|
|
||||||
}
|
|
||||||
if cfg.EmailSettings.SMTPPassword != model.FAKE_SETTING && len(cfg.EmailSettings.SMTPPassword) != 0 {
|
if cfg.EmailSettings.SMTPPassword != model.FAKE_SETTING && len(cfg.EmailSettings.SMTPPassword) != 0 {
|
||||||
t.Fatal("did not sanitize properly")
|
t.Fatal("did not sanitize properly")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,6 @@
|
|||||||
"SMTPPort": "2500",
|
"SMTPPort": "2500",
|
||||||
"ConnectionSecurity": "",
|
"ConnectionSecurity": "",
|
||||||
"InviteSalt": "",
|
"InviteSalt": "",
|
||||||
"PasswordResetSalt": "",
|
|
||||||
"SendPushNotifications": false,
|
"SendPushNotifications": false,
|
||||||
"PushNotificationServer": "",
|
"PushNotificationServer": "",
|
||||||
"PushNotificationContents": "generic",
|
"PushNotificationContents": "generic",
|
||||||
|
|||||||
@@ -250,7 +250,6 @@ type EmailSettings struct {
|
|||||||
SMTPPort string
|
SMTPPort string
|
||||||
ConnectionSecurity string
|
ConnectionSecurity string
|
||||||
InviteSalt string
|
InviteSalt string
|
||||||
PasswordResetSalt string
|
|
||||||
SendPushNotifications *bool
|
SendPushNotifications *bool
|
||||||
PushNotificationServer *string
|
PushNotificationServer *string
|
||||||
PushNotificationContents *string
|
PushNotificationContents *string
|
||||||
@@ -503,10 +502,6 @@ func (o *Config) SetDefaults() {
|
|||||||
o.EmailSettings.InviteSalt = NewRandomString(32)
|
o.EmailSettings.InviteSalt = NewRandomString(32)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(o.EmailSettings.PasswordResetSalt) == 0 {
|
|
||||||
o.EmailSettings.PasswordResetSalt = NewRandomString(32)
|
|
||||||
}
|
|
||||||
|
|
||||||
if o.ServiceSettings.SiteURL == nil {
|
if o.ServiceSettings.SiteURL == nil {
|
||||||
o.ServiceSettings.SiteURL = new(string)
|
o.ServiceSettings.SiteURL = new(string)
|
||||||
*o.ServiceSettings.SiteURL = SERVICE_SETTINGS_DEFAULT_SITE_URL
|
*o.ServiceSettings.SiteURL = SERVICE_SETTINGS_DEFAULT_SITE_URL
|
||||||
@@ -1288,10 +1283,6 @@ func (o *Config) IsValid() *AppError {
|
|||||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.email_salt.app_error", nil, "")
|
return NewLocAppError("Config.IsValid", "model.config.is_valid.email_salt.app_error", nil, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(o.EmailSettings.PasswordResetSalt) < 32 {
|
|
||||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.email_reset_salt.app_error", nil, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
if *o.EmailSettings.EmailBatchingBufferSize <= 0 {
|
if *o.EmailSettings.EmailBatchingBufferSize <= 0 {
|
||||||
return NewLocAppError("Config.IsValid", "model.config.is_valid.email_batching_buffer_size.app_error", nil, "")
|
return NewLocAppError("Config.IsValid", "model.config.is_valid.email_batching_buffer_size.app_error", nil, "")
|
||||||
}
|
}
|
||||||
@@ -1438,7 +1429,6 @@ func (o *Config) Sanitize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
o.EmailSettings.InviteSalt = FAKE_SETTING
|
o.EmailSettings.InviteSalt = FAKE_SETTING
|
||||||
o.EmailSettings.PasswordResetSalt = FAKE_SETTING
|
|
||||||
if len(o.EmailSettings.SMTPPassword) > 0 {
|
if len(o.EmailSettings.SMTPPassword) > 0 {
|
||||||
o.EmailSettings.SMTPPassword = FAKE_SETTING
|
o.EmailSettings.SMTPPassword = FAKE_SETTING
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ func LoadConfig(fileName string) {
|
|||||||
CfgFileName = viper.ConfigFileUsed()
|
CfgFileName = viper.ConfigFileUsed()
|
||||||
|
|
||||||
needSave := len(config.SqlSettings.AtRestEncryptKey) == 0 || len(*config.FileSettings.PublicLinkSalt) == 0 ||
|
needSave := len(config.SqlSettings.AtRestEncryptKey) == 0 || len(*config.FileSettings.PublicLinkSalt) == 0 ||
|
||||||
len(config.EmailSettings.InviteSalt) == 0 || len(config.EmailSettings.PasswordResetSalt) == 0
|
len(config.EmailSettings.InviteSalt) == 0
|
||||||
|
|
||||||
config.SetDefaults()
|
config.SetDefaults()
|
||||||
|
|
||||||
@@ -542,9 +542,6 @@ func Desanitize(cfg *model.Config) {
|
|||||||
if cfg.EmailSettings.InviteSalt == model.FAKE_SETTING {
|
if cfg.EmailSettings.InviteSalt == model.FAKE_SETTING {
|
||||||
cfg.EmailSettings.InviteSalt = Cfg.EmailSettings.InviteSalt
|
cfg.EmailSettings.InviteSalt = Cfg.EmailSettings.InviteSalt
|
||||||
}
|
}
|
||||||
if cfg.EmailSettings.PasswordResetSalt == model.FAKE_SETTING {
|
|
||||||
cfg.EmailSettings.PasswordResetSalt = Cfg.EmailSettings.PasswordResetSalt
|
|
||||||
}
|
|
||||||
if cfg.EmailSettings.SMTPPassword == model.FAKE_SETTING {
|
if cfg.EmailSettings.SMTPPassword == model.FAKE_SETTING {
|
||||||
cfg.EmailSettings.SMTPPassword = Cfg.EmailSettings.SMTPPassword
|
cfg.EmailSettings.SMTPPassword = Cfg.EmailSettings.SMTPPassword
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import TextSetting from './text_setting.jsx';
|
|||||||
import Setting from './setting.jsx';
|
import Setting from './setting.jsx';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
import GeneratedSetting from './generated_setting.jsx';
|
|
||||||
|
|
||||||
export default class PasswordSettings extends AdminSettings {
|
export default class PasswordSettings extends AdminSettings {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -30,8 +29,7 @@ export default class PasswordSettings extends AdminSettings {
|
|||||||
passwordNumber: props.config.PasswordSettings.Number,
|
passwordNumber: props.config.PasswordSettings.Number,
|
||||||
passwordUppercase: props.config.PasswordSettings.Uppercase,
|
passwordUppercase: props.config.PasswordSettings.Uppercase,
|
||||||
passwordSymbol: props.config.PasswordSettings.Symbol,
|
passwordSymbol: props.config.PasswordSettings.Symbol,
|
||||||
maximumLoginAttempts: props.config.ServiceSettings.MaximumLoginAttempts,
|
maximumLoginAttempts: props.config.ServiceSettings.MaximumLoginAttempts
|
||||||
passwordResetSalt: props.config.EmailSettings.PasswordResetSalt
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update sample message from config settings
|
// Update sample message from config settings
|
||||||
@@ -73,7 +71,6 @@ export default class PasswordSettings extends AdminSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.ServiceSettings.MaximumLoginAttempts = this.parseIntNonZero(this.state.maximumLoginAttempts);
|
config.ServiceSettings.MaximumLoginAttempts = this.parseIntNonZero(this.state.maximumLoginAttempts);
|
||||||
config.EmailSettings.PasswordResetSalt = this.state.passwordResetSalt;
|
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@@ -85,8 +82,7 @@ export default class PasswordSettings extends AdminSettings {
|
|||||||
passwordNumber: config.PasswordSettings.Number,
|
passwordNumber: config.PasswordSettings.Number,
|
||||||
passwordUppercase: config.PasswordSettings.Uppercase,
|
passwordUppercase: config.PasswordSettings.Uppercase,
|
||||||
passwordSymbol: config.PasswordSettings.Symbol,
|
passwordSymbol: config.PasswordSettings.Symbol,
|
||||||
maximumLoginAttempts: config.ServiceSettings.MaximumLoginAttempts,
|
maximumLoginAttempts: config.ServiceSettings.MaximumLoginAttempts
|
||||||
passwordResetSalt: config.EmailSettings.PasswordResetSalt
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,30 +257,6 @@ export default class PasswordSettings extends AdminSettings {
|
|||||||
return (
|
return (
|
||||||
<SettingsGroup>
|
<SettingsGroup>
|
||||||
{passwordSettings}
|
{passwordSettings}
|
||||||
<GeneratedSetting
|
|
||||||
id='passwordResetSalt'
|
|
||||||
label={
|
|
||||||
<FormattedMessage
|
|
||||||
id='admin.email.passwordSaltTitle'
|
|
||||||
defaultMessage='Password Reset Salt:'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
helpText={
|
|
||||||
<FormattedMessage
|
|
||||||
id='admin.email.passwordSaltDescription'
|
|
||||||
defaultMessage='32-character salt added to signing of password reset emails. Randomly generated on install. Click "Regenerate" to create new salt.'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
value={this.state.passwordResetSalt}
|
|
||||||
onChange={this.handleChange}
|
|
||||||
disabled={this.state.sendEmailNotifications}
|
|
||||||
disabledText={
|
|
||||||
<FormattedMessage
|
|
||||||
id='admin.security.passwordResetSalt.disabled'
|
|
||||||
defaultMessage='Password reset salt cannot be changed while sending emails is disabled.'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<TextSetting
|
<TextSetting
|
||||||
id='maximumLoginAttempts'
|
id='maximumLoginAttempts'
|
||||||
label={
|
label={
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user