From b2df4978d89c7d3ca224d832241e02f05d5f12a6 Mon Sep 17 00:00:00 2001 From: Tarun Koyalwar Date: Sun, 1 Oct 2023 22:14:50 +0530 Subject: [PATCH] fix code resigning in tests --- v2/cmd/integration-test/code.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/v2/cmd/integration-test/code.go b/v2/cmd/integration-test/code.go index 14dad19fae..d58a960d10 100644 --- a/v2/cmd/integration-test/code.go +++ b/v2/cmd/integration-test/code.go @@ -3,6 +3,7 @@ package main import ( "errors" "log" + "os" "path/filepath" osutils "github.com/projectdiscovery/utils/os" @@ -31,6 +32,23 @@ var ( ) func init() { + // since re-signing of code protocol templates is not supported + // for testing purposes remove them from template + // to test signing of code protocol templates + for _, v := range codeTestCases { + if v.DisableOn != nil && v.DisableOn() { + continue + } + bin, err := os.ReadFile(v.Path) + if err != nil { + panic(err) + } + updated := signer.RemoveSignatureFromData(bin) + if err := os.WriteFile(v.Path, updated, 0644); err != nil { + panic(err) + } + } + var err error ecdsaPrivateKeyAbsPath, err = filepath.Abs("protocols/code/ecdsa-priv-key.pem") if err != nil {