Skip to content

Commit 3c68b26

Browse files
chore: upgrade Go from 1.23.4 to 1.24.4 (release-2.14) (#23294)
Signed-off-by: Ville Vesilehto <[email protected]> Co-authored-by: Michael Crenshaw <[email protected]>
1 parent 5f89062 commit 3c68b26

File tree

9 files changed

+98
-12
lines changed

9 files changed

+98
-12
lines changed

.github/workflows/ci-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
env:
1515
# Golang version to use across CI steps
1616
# renovate: datasource=golang-version packageName=golang
17-
GOLANG_VERSION: '1.23.3'
17+
GOLANG_VERSION: '1.24.4'
1818

1919
concurrency:
2020
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/image.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
with:
5454
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
5555
# renovate: datasource=golang-version packageName=golang
56-
go-version: 1.23.3
56+
go-version: 1.24.4
5757
platforms: ${{ needs.set-vars.outputs.platforms }}
5858
push: false
5959

@@ -70,7 +70,7 @@ jobs:
7070
ghcr_image_name: ghcr.io/argoproj/argo-cd/argocd:${{ needs.set-vars.outputs.image-tag }}
7171
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
7272
# renovate: datasource=golang-version packageName=golang
73-
go-version: 1.23.3
73+
go-version: 1.24.4
7474
platforms: ${{ needs.set-vars.outputs.platforms }}
7575
push: true
7676
secrets:

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions: {}
1111

1212
env:
1313
# renovate: datasource=golang-version packageName=golang
14-
GOLANG_VERSION: '1.23.3' # Note: go-version must also be set in job argocd-image.with.go-version
14+
GOLANG_VERSION: '1.24.4' # Note: go-version must also be set in job argocd-image.with.go-version
1515

1616
jobs:
1717
argocd-image:
@@ -25,7 +25,7 @@ jobs:
2525
quay_image_name: quay.io/argoproj/argocd:${{ github.ref_name }}
2626
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
2727
# renovate: datasource=golang-version packageName=golang
28-
go-version: 1.23.3
28+
go-version: 1.24.4
2929
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
3030
push: true
3131
secrets:

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARG BASE_IMAGE=docker.io/library/ubuntu:24.04@sha256:3f85b7caad41a95462cf5b787d8
44
# Initial stage which pulls prepares build dependencies and CLI tooling we need for our final image
55
# Also used as the image in CI jobs so needs all dependencies
66
####################################################################################################
7-
FROM docker.io/library/golang:1.23.3@sha256:d56c3e08fe5b27729ee3834854ae8f7015af48fd651cd25d1e3bcf3c19830174 AS builder
7+
FROM docker.io/library/golang:1.24.4@sha256:db5d0afbfb4ab648af2393b92e87eaae9ad5e01132803d80caef91b5752d289c AS builder
88

99
RUN echo 'deb http://archive.debian.org/debian buster-backports main' >> /etc/apt/sources.list
1010

@@ -101,7 +101,7 @@ RUN HOST_ARCH=$TARGETARCH NODE_ENV='production' NODE_ONLINE_ENV='online' NODE_OP
101101
####################################################################################################
102102
# Argo CD Build stage which performs the actual build of Argo CD binaries
103103
####################################################################################################
104-
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.23.3@sha256:d56c3e08fe5b27729ee3834854ae8f7015af48fd651cd25d1e3bcf3c19830174 AS argocd-build
104+
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.24.4@sha256:db5d0afbfb4ab648af2393b92e87eaae9ad5e01132803d80caef91b5752d289c AS argocd-build
105105

106106
WORKDIR /go/src/github.com/argoproj/argo-cd
107107

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/argoproj/argo-cd/v2
22

3-
go 1.23.0
3+
go 1.24.4
44

55
require (
66
code.gitea.io/sdk/gitea v0.19.0

test/container/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN ln -s /usr/lib/$(uname -m)-linux-gnu /usr/lib/linux-gnu
88
# Please make sure to also check the contained yarn version and update the references below when upgrading this image's version
99
FROM docker.io/library/node:22.9.0@sha256:69e667a79aa41ec0db50bc452a60e705ca16f35285eaf037ebe627a65a5cdf52 as node
1010

11-
FROM docker.io/library/golang:1.23.4@sha256:70031844b8c225351d0bb63e2c383f80db85d92ba894e3da7e13bcf80efa9a37 as golang
11+
FROM docker.io/library/golang:1.24.4@sha256:db5d0afbfb4ab648af2393b92e87eaae9ad5e01132803d80caef91b5752d289c as golang
1212

1313
FROM docker.io/library/registry:2.8@sha256:ac0192b549007e22998eb74e8d8488dcfe70f1489520c3b144a6047ac5efbe90 as registry
1414

test/remote/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG BASE_IMAGE=docker.io/library/ubuntu:24.04@sha256:3f85b7caad41a95462cf5b787d8a04604c8262cdcdf9a472b8c52ef83375fe15
22

3-
FROM docker.io/library/golang:1.23.4@sha256:81e1da9b9604cdee2bc226e90e15f9d51ae6a8cd2271dc341c42ca0926c3b83f AS go
3+
FROM docker.io/library/golang:1.24.4@sha256:db5d0afbfb4ab648af2393b92e87eaae9ad5e01132803d80caef91b5752d289c AS go
44

55
RUN go install github.com/mattn/goreman@latest && \
66
go install github.com/kisielk/godepgraph@latest

util/tls/tls.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ func publicKey(priv interface{}) interface{} {
193193
func pemBlockForKey(priv interface{}) *pem.Block {
194194
switch k := priv.(type) {
195195
case *rsa.PrivateKey:
196+
// In Go 1.24+, MarshalPKCS1PrivateKey calls Precompute() which can panic
197+
// if the key is invalid. Validate the key first.
198+
if k == nil || k.Validate() != nil {
199+
return nil
200+
}
196201
return &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(k)}
197202
case *ecdsa.PrivateKey:
198203
b, err := x509.MarshalECPrivateKey(k)
@@ -298,7 +303,11 @@ func generatePEM(opts CertOptions) ([]byte, []byte, error) {
298303
return nil, nil, err
299304
}
300305
certpem := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certBytes})
301-
keypem := pem.EncodeToMemory(pemBlockForKey(privateKey))
306+
keyBlock := pemBlockForKey(privateKey)
307+
if keyBlock == nil {
308+
return nil, nil, errors.New("failed to encode private key")
309+
}
310+
keypem := pem.EncodeToMemory(keyBlock)
302311
return certpem, keypem, nil
303312
}
304313

@@ -321,7 +330,11 @@ func EncodeX509KeyPair(cert tls.Certificate) ([]byte, []byte) {
321330
for _, certtmp := range cert.Certificate {
322331
certpem = append(certpem, pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certtmp})...)
323332
}
324-
keypem := pem.EncodeToMemory(pemBlockForKey(cert.PrivateKey))
333+
keyBlock := pemBlockForKey(cert.PrivateKey)
334+
if keyBlock == nil {
335+
return certpem, []byte{}
336+
}
337+
keypem := pem.EncodeToMemory(keyBlock)
325338
return certpem, keypem
326339
}
327340

util/tls/tls_test.go

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package tls
22

33
import (
4+
"crypto/rsa"
45
"crypto/tls"
56
"crypto/x509"
67
"encoding/pem"
78
"errors"
89
"fmt"
10+
"math/big"
911
"os"
1012
"strings"
1113
"testing"
@@ -452,3 +454,74 @@ func TestLoadX509CertPool(t *testing.T) {
452454
require.Nil(t, p)
453455
})
454456
}
457+
458+
func TestEncodeX509KeyPair_InvalidRSAKey(t *testing.T) {
459+
t.Run("Nil RSA private key", func(t *testing.T) {
460+
cert := tls.Certificate{
461+
Certificate: [][]byte{{0x30, 0x82}}, // minimal DER certificate bytes
462+
PrivateKey: (*rsa.PrivateKey)(nil),
463+
}
464+
certPEM, keyPEM := EncodeX509KeyPair(cert)
465+
assert.NotEmpty(t, certPEM)
466+
assert.Empty(t, keyPEM)
467+
})
468+
469+
t.Run("RSA private key that fails validation", func(t *testing.T) {
470+
// Create an RSA key with invalid parameters that will fail Validate()
471+
invalidKey := &rsa.PrivateKey{
472+
PublicKey: rsa.PublicKey{
473+
N: big.NewInt(1), // Too small modulus, will fail validation
474+
E: 65537,
475+
},
476+
D: big.NewInt(1), // Invalid private exponent
477+
}
478+
cert := tls.Certificate{
479+
Certificate: [][]byte{{0x30, 0x82}}, // minimal DER certificate bytes
480+
PrivateKey: invalidKey,
481+
}
482+
certPEM, keyPEM := EncodeX509KeyPair(cert)
483+
assert.NotEmpty(t, certPEM)
484+
assert.Empty(t, keyPEM)
485+
})
486+
487+
t.Run("RSA private key with inconsistent parameters", func(t *testing.T) {
488+
invalidKey := &rsa.PrivateKey{
489+
PublicKey: rsa.PublicKey{
490+
N: big.NewInt(35),
491+
E: 65537,
492+
},
493+
D: big.NewInt(99999),
494+
}
495+
cert := tls.Certificate{
496+
Certificate: [][]byte{{0x30, 0x82}}, // minimal DER certificate bytes
497+
PrivateKey: invalidKey,
498+
}
499+
certPEM, keyPEM := EncodeX509KeyPair(cert)
500+
assert.NotEmpty(t, certPEM)
501+
assert.Empty(t, keyPEM)
502+
})
503+
504+
t.Run("Unsupported private key type", func(t *testing.T) {
505+
// Use a type that's not *rsa.PrivateKey or *ecdsa.PrivateKey
506+
cert := tls.Certificate{
507+
Certificate: [][]byte{{0x30, 0x82}}, // minimal DER certificate bytes
508+
PrivateKey: "not a private key", // Unsupported type
509+
}
510+
certPEM, keyPEM := EncodeX509KeyPair(cert)
511+
assert.NotEmpty(t, certPEM)
512+
assert.Empty(t, keyPEM)
513+
})
514+
515+
t.Run("Valid RSA private key should work", func(t *testing.T) {
516+
// Generate a valid RSA key for testing
517+
opts := CertOptions{Hosts: []string{"localhost"}, Organization: "Test"}
518+
validCert, err := GenerateX509KeyPair(opts)
519+
require.NoError(t, err)
520+
521+
certPEM, keyPEM := EncodeX509KeyPair(*validCert)
522+
assert.NotEmpty(t, certPEM)
523+
assert.NotEmpty(t, keyPEM)
524+
assert.Contains(t, string(keyPEM), "-----BEGIN RSA PRIVATE KEY-----")
525+
assert.Contains(t, string(keyPEM), "-----END RSA PRIVATE KEY-----")
526+
})
527+
}

0 commit comments

Comments
 (0)