Skip to content

Commit

Permalink
feat: return message if the key in the file differs from the key in t…
Browse files Browse the repository at this point in the history
…he driver
  • Loading branch information
Alexander Huck committed Feb 8, 2024
1 parent 5f32c60 commit 60ef55d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package skipper

import (
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
Expand Down Expand Up @@ -231,7 +232,10 @@ func secretYamlFileLoader(secretFileList *[]*SecretFile) YamlFileLoaderFunc {

// Value returns the actual secret value.
func (s *Secret) Value() (string, error) {
return s.Driver.Decrypt(s.Data.Data, s.Data.PublicKey)
if s.Driver.GetKey() != s.Data.Key {
fmt.Fprintf(os.Stderr, "key in secret file '%s' differs from the key in the inventory\n", s.Path())
}
return s.Driver.Decrypt(s.Data.Data, s.Data.Key)
}

// FullName returns the full secret name as it would be expected to ocurr in a class/target.
Expand Down

0 comments on commit 60ef55d

Please sign in to comment.