Skip to content

Commit e5f4fa3

Browse files
committed
use default for salt/secret for now
1 parent b05469b commit e5f4fa3

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

internal/config/services/encrypt/local.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ func deriveKey(password string, salt string) []byte {
4343
func (l *localVault) Initialize() error {
4444

4545
masterPassword := l.config.GetStringWithDefault("password", common.DefaultServerSecret)
46-
salt := l.config.GetStringWithDefault("salt", common.DefaultLoginServerEndpoint)
46+
salt := l.config.GetStringWithDefault("salt", common.DefaultServerSecret) // Use hostname as default salt
4747

48+
// Warn if using default secrets
4849
if strings.EqualFold(masterPassword, common.DefaultServerSecret) ||
4950
strings.EqualFold(salt, common.DefaultServerSecret) {
5051
logrus.Warningln("local encryption service configured with default secrets. See https://docs.thand.io/configuration/file.html#encryption-service")

internal/config/services/encryption.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (e *localClient) configureEncryption() models.EncryptionImpl {
4040
// better alternative than the default
4141

4242
if !configValues.HasString("salt") {
43-
configValues.SetKeyWithValue("salt", e.GetEnvironmentConfig().Hostname)
43+
configValues.SetKeyWithValue("salt", e.GetEnvironmentConfig().GetIdentifier())
4444
}
4545

4646
if !configValues.HasString("password") && len(e.GetSecret()) > 0 {

internal/models/common.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,8 @@ func (pc *BasicConfig) HasString(key string) bool {
159159
if pc == nil {
160160
return false
161161
}
162-
if _, ok := (*pc)[key]; ok {
163-
return ok
164-
}
165-
return false
162+
_, ok := (*pc)[key]
163+
return ok
166164
}
167165

168166
func (pc *BasicConfig) GetInt(key string) (int, bool) {

0 commit comments

Comments
 (0)