Skip to content

Commit 52277e1

Browse files
Go module upgrades to fix CVE-2025-22872 (#675)
* _bin/tools/go get golang.org/x/net@latest Signed-off-by: Richard Wall <[email protected]> * make go-tidy Signed-off-by: Richard Wall <[email protected]> * _bin/tools/go get [email protected] Signed-off-by: Richard Wall <[email protected]> * Use testing.Context (a Go 1.24 feature) Signed-off-by: Richard Wall <[email protected]> * Fix govet warnings Signed-off-by: Richard Wall <[email protected]> * Remove obsolete test We have since replaced all the calls to log.Print and log.Fatal Signed-off-by: Richard Wall <[email protected]> --------- Signed-off-by: Richard Wall <[email protected]> Co-authored-by: Richard Wall <[email protected]>
1 parent ee0d9af commit 52277e1

File tree

12 files changed

+38
-88
lines changed

12 files changed

+38
-88
lines changed

cmd/agent_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestAgentRunOneShot(t *testing.T) {
3939
return
4040
}
4141
t.Log("Running child process")
42-
ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
42+
ctx, cancel := context.WithTimeout(t.Context(), time.Second*3)
4343
defer cancel()
4444
cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestAgentRunOneShot$")
4545
var (

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/jetstack/preflight
22

3-
go 1.23.4
3+
go 1.24.4
44

55
require (
66
github.com/Venafi/vcert/v5 v5.8.1
@@ -15,7 +15,7 @@ require (
1515
github.com/spf13/cobra v1.8.1
1616
github.com/spf13/pflag v1.0.5
1717
github.com/stretchr/testify v1.10.0
18-
golang.org/x/sync v0.11.0
18+
golang.org/x/sync v0.15.0
1919
gopkg.in/yaml.v2 v2.4.0
2020
k8s.io/api v0.33.0-alpha.1
2121
k8s.io/apimachinery v0.33.0-alpha.1
@@ -57,9 +57,9 @@ require (
5757
go.opentelemetry.io/otel/trace v1.28.0 // indirect
5858
go.uber.org/multierr v1.11.0 // indirect
5959
go.uber.org/zap v1.27.0 // indirect
60-
golang.org/x/crypto v0.35.0 // indirect
60+
golang.org/x/crypto v0.39.0 // indirect
6161
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
62-
golang.org/x/net v0.36.0 // indirect
62+
golang.org/x/net v0.41.0 // indirect
6363
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
6464
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect
6565
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect
@@ -95,9 +95,9 @@ require (
9595
github.com/prometheus/common v0.62.0 // indirect
9696
github.com/prometheus/procfs v0.15.1 // indirect
9797
golang.org/x/oauth2 v0.24.0 // indirect
98-
golang.org/x/sys v0.30.0 // indirect
99-
golang.org/x/term v0.29.0 // indirect
100-
golang.org/x/text v0.22.0 // indirect
98+
golang.org/x/sys v0.33.0 // indirect
99+
golang.org/x/term v0.32.0 // indirect
100+
golang.org/x/text v0.26.0 // indirect
101101
golang.org/x/time v0.7.0 // indirect
102102
google.golang.org/protobuf v1.36.1 // indirect
103103
gopkg.in/inf.v0 v0.9.1 // indirect

go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
224224
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
225225
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
226226
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
227-
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
228-
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
227+
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
228+
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
229229
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
230230
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
231231
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -234,36 +234,36 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
234234
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
235235
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
236236
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
237-
golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA=
238-
golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I=
237+
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
238+
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
239239
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
240240
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
241241
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
242242
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
243243
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
244-
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
245-
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
244+
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
245+
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
246246
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
247247
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
248248
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
249249
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
250250
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
251-
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
252-
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
253-
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
254-
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
251+
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
252+
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
253+
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
254+
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
255255
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
256256
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
257-
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
258-
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
257+
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
258+
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
259259
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
260260
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
261261
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
262262
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
263263
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
264264
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
265-
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
266-
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
265+
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
266+
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
267267
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
268268
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
269269
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

pkg/agent/config_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ func Test_ValidateAndCombineConfig_VenafiCloudKeyPair(t *testing.T) {
659659
t.Run("server, uploader_id, and cluster name are correctly passed", func(t *testing.T) {
660660
t.Setenv("POD_NAMESPACE", "venafi")
661661

662-
ctx, cancel := context.WithCancel(context.Background())
662+
ctx, cancel := context.WithCancel(t.Context())
663663
defer cancel()
664664
log := ktesting.NewLogger(t, ktesting.NewConfig(ktesting.Verbosity(10)))
665665
ctx = klog.NewContext(ctx, log)
@@ -704,7 +704,7 @@ func Test_ValidateAndCombineConfig_VenafiConnection(t *testing.T) {
704704
t.Setenv("KUBECONFIG", testutil.WithKubeconfig(t, cfg))
705705
srv, cert, setVenafiCloudAssert := testutil.FakeVenafiCloud(t)
706706
for _, obj := range testutil.Parse(
707-
testutil.VenConnRBAC + testutil.Undent(fmt.Sprintf(`
707+
testutil.VenConnRBAC + testutil.Undent(`
708708
---
709709
apiVersion: jetstack.io/v1alpha1
710710
kind: VenafiConnection
@@ -751,8 +751,8 @@ func Test_ValidateAndCombineConfig_VenafiConnection(t *testing.T) {
751751
- kind: ServiceAccount
752752
name: venafi-connection
753753
namespace: venafi
754-
`))) {
755-
require.NoError(t, kcl.Create(context.Background(), obj))
754+
`)) {
755+
require.NoError(t, kcl.Create(t.Context(), obj))
756756
}
757757

758758
t.Run("err when cluster_id field is empty", func(t *testing.T) {
@@ -768,7 +768,7 @@ func Test_ValidateAndCombineConfig_VenafiConnection(t *testing.T) {
768768
})
769769

770770
t.Run("the server field is ignored when VenafiConnection is used", func(t *testing.T) {
771-
ctx, cancel := context.WithCancel(context.Background())
771+
ctx, cancel := context.WithCancel(t.Context())
772772
defer cancel()
773773
log := ktesting.NewLogger(t, ktesting.NewConfig(ktesting.Verbosity(10)))
774774
ctx = klog.NewContext(ctx, log)

pkg/client/client_venconn_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
//
3737
// [1] https://github.com/kubernetes-sigs/controller-runtime/issues/2341
3838
func TestVenConnClient_PostDataReadingsWithOptions(t *testing.T) {
39-
ctx, cancel := context.WithCancel(context.Background())
39+
ctx, cancel := context.WithCancel(t.Context())
4040
defer cancel()
4141
log := ktesting.NewLogger(t, ktesting.NewConfig(ktesting.Verbosity(10)))
4242
ctx = klog.NewContext(ctx, log)

pkg/datagatherer/k8s/dynamic_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package k8s
22

33
import (
4-
"context"
54
"encoding/json"
65
"fmt"
76
"reflect"
@@ -117,7 +116,7 @@ func sortGatheredResources(list []*api.GatheredResource) {
117116
}
118117

119118
func TestNewDataGathererWithClientAndDynamicInformer(t *testing.T) {
120-
ctx := context.Background()
119+
ctx := t.Context()
121120
config := ConfigDynamic{
122121
ExcludeNamespaces: []string{"kube-system"},
123122
GroupVersionResource: schema.GroupVersionResource{Group: "foobar", Version: "v1", Resource: "foos"},
@@ -164,7 +163,7 @@ func TestNewDataGathererWithClientAndDynamicInformer(t *testing.T) {
164163
}
165164

166165
func TestNewDataGathererWithClientAndSharedIndexInformer(t *testing.T) {
167-
ctx := context.Background()
166+
ctx := t.Context()
168167
config := ConfigDynamic{
169168
IncludeNamespaces: []string{"a"},
170169
GroupVersionResource: schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"},
@@ -638,7 +637,7 @@ func TestDynamicGatherer_Fetch(t *testing.T) {
638637
for name, tc := range tests {
639638
t.Run(name, func(t *testing.T) {
640639
var wg sync.WaitGroup
641-
ctx := context.Background()
640+
ctx := t.Context()
642641
gvrToListKind := map[schema.GroupVersionResource]string{
643642
{Group: "foobar", Version: "v1", Resource: "foos"}: "UnstructuredList",
644643
{Group: "apps", Version: "v1", Resource: "deployments"}: "UnstructuredList",
@@ -958,7 +957,7 @@ func TestDynamicGathererNativeResources_Fetch(t *testing.T) {
958957
for name, tc := range tests {
959958
t.Run(name, func(t *testing.T) {
960959
var wg sync.WaitGroup
961-
ctx := context.Background()
960+
ctx := t.Context()
962961

963962
clientset := fakeclientset.NewSimpleClientset(tc.addObjects...)
964963

pkg/echo/echo_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package echo
22

33
import (
44
"bytes"
5-
"context"
65
"encoding/json"
76
"net/http"
87
"net/http/httptest"
@@ -61,7 +60,7 @@ func TestEchoServerRequestResponse(t *testing.T) {
6160
}
6261

6362
// generate a request to test the handler containing the JSON data as a body
64-
req, err := http.NewRequestWithContext(context.TODO(), sampleUpload.method, "http://example.com/api/v1/datareadings", bytes.NewBuffer(requestBodyJSON))
63+
req, err := http.NewRequestWithContext(t.Context(), sampleUpload.method, "http://example.com/api/v1/datareadings", bytes.NewBuffer(requestBodyJSON))
6564
if err != nil {
6665
t.Fatalf("[%s]\nfailed to generate request to test echo server: %s", sampleUpload.description, err)
6766
}

pkg/internal/cyberark/dataupload/dataupload_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package dataupload_test
22

33
import (
4-
"context"
54
"crypto/x509"
65
"encoding/pem"
76
"fmt"
@@ -113,7 +112,7 @@ func TestCyberArkClient_PostDataReadingsWithOptions(t *testing.T) {
113112
cyberArkClient, err := dataupload.NewCyberArkClient(certPool, server.Server.URL, tc.authenticate)
114113
require.NoError(t, err)
115114

116-
err = cyberArkClient.PostDataReadingsWithOptions(context.TODO(), tc.payload, tc.opts)
115+
err = cyberArkClient.PostDataReadingsWithOptions(t.Context(), tc.payload, tc.opts)
117116
tc.requireFn(t, err)
118117
})
119118
}

pkg/internal/cyberark/identity/advance_authentication_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package identity
22

33
import (
4-
"context"
54
"fmt"
65
"testing"
76

@@ -98,7 +97,7 @@ func Test_IdentityAdvanceAuthentication(t *testing.T) {
9897

9998
for name, testSpec := range tests {
10099
t.Run(name, func(t *testing.T) {
101-
ctx := context.Background()
100+
ctx := t.Context()
102101

103102
identityServer := MockIdentityServer()
104103
defer identityServer.Close()

pkg/internal/cyberark/identity/start_authentication_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package identity
22

33
import (
4-
"context"
54
"fmt"
65
"testing"
76

@@ -39,7 +38,7 @@ func Test_IdentityStartAuthentication(t *testing.T) {
3938

4039
for name, testSpec := range tests {
4140
t.Run(name, func(t *testing.T) {
42-
ctx := context.Background()
41+
ctx := t.Context()
4342

4443
identityServer := MockIdentityServer()
4544
defer identityServer.Close()

0 commit comments

Comments
 (0)