Only GPG import keys with `.asc` extension

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals 2021-03-30 13:20:13 +02:00
parent 198b8e7dc1
commit c3e1252665
1 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path/filepath"
securejoin "github.com/cyphar/filepath-securejoin"
"go.mozilla.org/sops/v3"
@ -137,6 +138,9 @@ func (kd *KustomizeDecryptor) ImportKeys(ctx context.Context) error {
defer os.RemoveAll(tmpDir)
for name, key := range secret.Data {
if ext := filepath.Ext(name); ext != ".asc" {
continue
}
keyPath, err := securejoin.SecureJoin(tmpDir, name)
if err != nil {
return err