From 76dbb39aebddc768c39361ce8d34da9701bbd1f6 Mon Sep 17 00:00:00 2001 From: Alexander Huck Date: Thu, 8 Feb 2024 11:34:02 +0100 Subject: [PATCH] feat: return message if the key in the file differs from the key in the driver --- secret.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/secret.go b/secret.go index 38ca0e5..00a039c 100644 --- a/secret.go +++ b/secret.go @@ -2,6 +2,7 @@ package skipper import ( "fmt" + "os" "path/filepath" "regexp" "strings" @@ -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.