From 67596ef0cc76b32308d254342085f5f615b901ab Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 14 Sep 2021 12:52:46 -0700 Subject: [PATCH] fix sse-kms context unmarshal failure (#13206) json.Unmarshal expects a pointer receiver, otherwise kms.Context unmarshal fails with lack of pointer receiver, this becomes complicated due to type aliasing over map[string]string - fix it properly. --- internal/crypto/sse-kms.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/crypto/sse-kms.go b/internal/crypto/sse-kms.go index 7c0aa8f83..0ee23e466 100644 --- a/internal/crypto/sse-kms.go +++ b/internal/crypto/sse-kms.go @@ -210,8 +210,8 @@ func (ssekms) ParseMetadata(metadata map[string]string) (keyID string, kmsKey [] return keyID, kmsKey, sealedKey, ctx, Errorf("The internal KMS context is not base64-encoded") } var json = jsoniter.ConfigCompatibleWithStandardLibrary - if err = json.Unmarshal(b, ctx); err != nil { - return keyID, kmsKey, sealedKey, ctx, Errorf("The internal sealed KMS context is invalid") + if err = json.Unmarshal(b, &ctx); err != nil { + return keyID, kmsKey, sealedKey, ctx, Errorf("The internal sealed KMS context is invalid %w", err) } }