Skip to content

Commit

Permalink
Use SOPS DefaultDecryptionOrder
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed Aug 1, 2024
1 parent a21e977 commit 937837b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
10 changes: 1 addition & 9 deletions internal/decryptor/decryptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"io/fs"
"os"
"path/filepath"
"sort"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -287,14 +286,7 @@ func (d *Decryptor) SopsDecryptWithFormat(data []byte, inputFormat, outputFormat
return nil, sopsUserErr(fmt.Sprintf("failed to load encrypted %s data", sopsFormatToString[inputFormat]), err)
}

for _, group := range tree.Metadata.KeyGroups {
// Sort MasterKeys in the group so offline ones are tried first
sort.SliceStable(group, func(i, j int) bool {
return intkeyservice.IsOfflineMethod(group[i]) && !intkeyservice.IsOfflineMethod(group[j])
})
}

metadataKey, err := tree.Metadata.GetDataKeyWithKeyServices(d.keyServiceServer(), nil)
metadataKey, err := tree.Metadata.GetDataKeyWithKeyServices(d.keyServiceServer(), sops.DefaultDecryptionOrder)
if err != nil {
return nil, sopsUserErr("cannot get sops data key", err)
}
Expand Down
33 changes: 0 additions & 33 deletions internal/sops/keyservice/keyservice.go

This file was deleted.

0 comments on commit 937837b

Please sign in to comment.