From 1b59b6a35f56a8241e557ea1d6cfab5e848529ee Mon Sep 17 00:00:00 2001 From: YiscahLevySilas1 Date: Tue, 16 Jan 2024 11:59:28 +0200 Subject: [PATCH] fix backslashes Signed-off-by: YiscahLevySilas1 --- core/pkg/opaprocessor/utils.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/pkg/opaprocessor/utils.go b/core/pkg/opaprocessor/utils.go index 9f3c2f21..275d0910 100644 --- a/core/pkg/opaprocessor/utils.go +++ b/core/pkg/opaprocessor/utils.go @@ -2,6 +2,7 @@ package opaprocessor import ( "fmt" + "strings" logger "github.com/kubescape/go-logger" "github.com/kubescape/go-logger/helpers" @@ -75,7 +76,9 @@ var cosignVerifySignatureDefinition = func(bctx rego.BuiltinContext, a, b *ast.T if err != nil { return nil, fmt.Errorf("invalid parameter type: %v", err) } - result, err := verify(string(aStr), string(bStr)) + // Replace double backslashes with single backslashes + bbStr := strings.Replace(string(bStr), "\\n", "\n", -1) + result, err := verify(string(aStr), bbStr) if err != nil { // Do not change this log from debug level. We might find a lot of images without signature logger.L().Debug("failed to verify signature", helpers.String("image", string(aStr)), helpers.String("key", string(bStr)), helpers.Error(err))