fix: read imported member records with retained legacy data keys
Deploy olons-admin production / deploy (push) Successful in 7m14s
Deploy olons-admin production / deploy (push) Successful in 7m14s
This commit is contained in:
@@ -65,6 +65,13 @@ func DecryptField(ctx context.Context, encoded string) (string, error) {
|
||||
if key, keyErr := fieldKey(ctx); keyErr == nil {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
// Imported HotGo records can use an older dataKey; never use these keys for new writes.
|
||||
for _, secret := range g.Cfg().MustGet(ctx, "security.legacyDataKeys", []string{}).Strings() {
|
||||
if secret = strings.TrimSpace(secret); secret != "" {
|
||||
sum := sha256.Sum256([]byte(secret))
|
||||
keys = append(keys, sum[:])
|
||||
}
|
||||
}
|
||||
for _, key := range keys {
|
||||
block, keyErr := aes.NewCipher(key)
|
||||
if keyErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user