Browse Source

fix: upgrade go version (#5529)

* fix: upgrade go version

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>

On-behalf-of: Gergely Brautigam <gergely.brautigam@sap.com>

* added a workaround

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>

---------

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
Gergely Brautigam 5 months ago
parent
commit
0f7a6fe9d0
3 changed files with 14 additions and 2 deletions
  1. 1 1
      e2e/go.mod
  2. 1 1
      go.mod
  3. 12 0
      pkg/template/v2/pem.go

+ 1 - 1
e2e/go.mod

@@ -1,6 +1,6 @@
 module github.com/external-secrets/external-secrets-e2e
 
-go 1.25.1
+go 1.25.3
 
 replace (
 	github.com/Masterminds/sprig/v3 => github.com/external-secrets/sprig/v3 v3.3.0

+ 1 - 1
go.mod

@@ -1,6 +1,6 @@
 module github.com/external-secrets/external-secrets
 
-go 1.25.1
+go 1.25.3
 
 replace github.com/Masterminds/sprig/v3 => github.com/external-secrets/sprig/v3 v3.3.0
 

+ 12 - 0
pkg/template/v2/pem.go

@@ -33,6 +33,7 @@ const (
 )
 
 func filterPEM(pemType, input string) (string, error) {
+	input = trimJunk(input)
 	data := []byte(input)
 	var blocks []byte
 	var block *pem.Block
@@ -63,6 +64,17 @@ func filterPEM(pemType, input string) (string, error) {
 	return string(blocks), nil
 }
 
+// trimJunk performs the same operation pem.Decode did until:
+// https://github.com/golang/go/issues/76124
+func trimJunk(input string) string {
+	index := strings.Index(input, "-----BEGIN")
+	if index == -1 {
+		return input
+	}
+
+	return input[index:]
+}
+
 func filterCertChain(certType, input string) (string, error) {
 	ordered, err := fetchX509CertChains([]byte(input))
 	if err != nil {