Skip to content

Commit 423e720

Browse files
michel-latermanmergify[bot]
authored andcommitted
Update to go v1.24.0 (#4543)
Update to go v1.24.0, change golang.org/x/crypto/pbkdf2 to crypto/pbkdf2 (cherry picked from commit c2b8d66) # Conflicts: # NOTICE.txt # go.mod # testing/go.mod
1 parent 5a3a488 commit 423e720

File tree

9 files changed

+109
-6
lines changed

9 files changed

+109
-6
lines changed

.buildkite/pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
22

33
env:
4-
SETUP_GVM_VERSION: "v0.5.0"
4+
SETUP_GVM_VERSION: "v0.5.1"
55
DOCKER_COMPOSE_VERSION: "1.25.5"
66
DOCKER_REGISTRY: "docker.elastic.co"
77
DOCKER_IMAGE: "${DOCKER_REGISTRY}/observability-ci/fleet-server" # needs to rename for rollback

.buildkite/scripts/local_build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set -euo pipefail
44

55
source .buildkite/scripts/common.sh
6+
67
add_bin_path
78
with_go
89

.go-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.23.6
1+
1.24.0

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ run:
44
timeout: 1m
55
build-tags:
66
- integration
7-
go: "1.23.6"
7+
go: "1.24.0"
88

99
issues:
1010
# Maximum count of issues with the same text.

NOTICE.txt

+40
Original file line numberDiff line numberDiff line change
@@ -5034,6 +5034,7 @@ THE SOFTWARE.
50345034

50355035

50365036
--------------------------------------------------------------------------------
5037+
<<<<<<< HEAD
50375038
Dependency : golang.org/x/crypto
50385039
Version: v0.32.0
50395040
Licence type (autodetected): BSD-3-Clause
@@ -5071,6 +5072,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50715072

50725073

50735074
--------------------------------------------------------------------------------
5075+
=======
5076+
>>>>>>> c2b8d66 (Update to go v1.24.0 (#4543))
50745077
Dependency : golang.org/x/sync
50755078
Version: v0.10.0
50765079
Licence type (autodetected): BSD-3-Clause
@@ -20082,6 +20085,43 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2008220085
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2008320086

2008420087

20088+
--------------------------------------------------------------------------------
20089+
Dependency : golang.org/x/crypto
20090+
Version: v0.33.0
20091+
Licence type (autodetected): BSD-3-Clause
20092+
--------------------------------------------------------------------------------
20093+
20094+
Contents of probable licence file $GOMODCACHE/golang.org/x/crypto@v0.33.0/LICENSE:
20095+
20096+
Copyright 2009 The Go Authors.
20097+
20098+
Redistribution and use in source and binary forms, with or without
20099+
modification, are permitted provided that the following conditions are
20100+
met:
20101+
20102+
* Redistributions of source code must retain the above copyright
20103+
notice, this list of conditions and the following disclaimer.
20104+
* Redistributions in binary form must reproduce the above
20105+
copyright notice, this list of conditions and the following disclaimer
20106+
in the documentation and/or other materials provided with the
20107+
distribution.
20108+
* Neither the name of Google LLC nor the names of its
20109+
contributors may be used to endorse or promote products derived from
20110+
this software without specific prior written permission.
20111+
20112+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20113+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20114+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20115+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20116+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20117+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20118+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20119+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20120+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20121+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20122+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20123+
20124+
2008520125
--------------------------------------------------------------------------------
2008620126
Dependency : golang.org/x/mod
2008720127
Version: v0.20.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Kind can be one of:
2+
# - breaking-change: a change to previously-documented behavior
3+
# - deprecation: functionality that is being removed in a later release
4+
# - bug-fix: fixes a problem in a previous version
5+
# - enhancement: extends functionality but does not break or fix existing behavior
6+
# - feature: new functionality
7+
# - known-issue: problems that we are aware of in a given version
8+
# - security: impacts on the security of a product or a user’s deployment.
9+
# - upgrade: important information for someone upgrading from a prior version
10+
# - other: does not fit into any of the other categories
11+
kind: enhancement
12+
13+
# Change summary; a 80ish characters long description of the change.
14+
summary: Update to go v1.24.0
15+
16+
# Long description; in case the summary is not enough to describe the change
17+
# this field accommodate a description without length limits.
18+
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
19+
#description:
20+
21+
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
22+
component: fleet-server
23+
24+
# PR URL; optional; the PR number that added the changeset.
25+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
26+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
27+
# Please provide it if you are adding a fragment for a different PR.
28+
pr: https://github.com/elastic/fleet-server/pull/4543
29+
30+
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
31+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
32+
#issue: https://github.com/owner/repo/1234

go.mod

+17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
module github.com/elastic/fleet-server/v7
22

3+
<<<<<<< HEAD
34
go 1.22.10
45

56
toolchain go1.23.3
7+
=======
8+
go 1.24
9+
>>>>>>> c2b8d66 (Update to go v1.24.0 (#4543))
610

711
require (
812
github.com/Pallinder/go-randomdata v1.2.0
@@ -37,8 +41,12 @@ require (
3741
go.elastic.co/apm/v2 v2.6.3
3842
go.elastic.co/ecszerolog v0.2.0
3943
go.uber.org/zap v1.27.0
44+
<<<<<<< HEAD
4045
golang.org/x/crypto v0.32.0
4146
golang.org/x/sync v0.10.0
47+
=======
48+
golang.org/x/sync v0.11.0
49+
>>>>>>> c2b8d66 (Update to go v1.24.0 (#4543))
4250
golang.org/x/time v0.5.0
4351
google.golang.org/grpc v1.63.2
4452
google.golang.org/protobuf v1.33.0
@@ -91,11 +99,20 @@ require (
9199
go.opentelemetry.io/otel/metric v1.28.0 // indirect
92100
go.opentelemetry.io/otel/trace v1.28.0 // indirect
93101
go.uber.org/multierr v1.11.0 // indirect
102+
<<<<<<< HEAD
94103
golang.org/x/mod v0.20.0 // indirect
95104
golang.org/x/net v0.34.0 // indirect
96105
golang.org/x/sys v0.29.0 // indirect
97106
golang.org/x/text v0.21.0 // indirect
98107
golang.org/x/tools v0.24.0 // indirect
108+
=======
109+
golang.org/x/crypto v0.33.0 // indirect
110+
golang.org/x/mod v0.23.0 // indirect
111+
golang.org/x/net v0.35.0 // indirect
112+
golang.org/x/sys v0.30.0 // indirect
113+
golang.org/x/text v0.22.0 // indirect
114+
golang.org/x/tools v0.30.0 // indirect
115+
>>>>>>> c2b8d66 (Update to go v1.24.0 (#4543))
99116
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
100117
gopkg.in/yaml.v2 v2.4.0 // indirect
101118
howett.net/plist v1.0.1 // indirect

internal/pkg/api/handleEnroll.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package api
77
import (
88
"context"
99
"crypto/hmac"
10+
"crypto/pbkdf2"
1011
"crypto/rand"
1112
"crypto/sha512"
1213
"encoding/base64"
@@ -20,7 +21,6 @@ import (
2021
"time"
2122

2223
"go.elastic.co/apm/v2"
23-
"golang.org/x/crypto/pbkdf2"
2424

2525
"github.com/elastic/elastic-agent-libs/str"
2626
"github.com/elastic/fleet-server/v7/internal/pkg/apikey"
@@ -745,7 +745,11 @@ func compareHashAndToken(zlog zerolog.Logger, hash string, token string, cfg con
745745
zlog.Error().Err(err).Msg("replace_token hash failed to base64 decode encoded")
746746
return false, ErrAgentCorrupted
747747
}
748-
key := pbkdf2.Key([]byte(token), salt, iterations, cfg.KeyLength, sha512.New)
748+
key, err := pbkdf2.Key(sha512.New, token, salt, iterations, cfg.KeyLength)
749+
if err != nil {
750+
zlog.Error().Err(err).Msg("pbkdf2 key creation failed")
751+
return false, ErrAgentCorrupted
752+
}
749753
// use `hmac.Equal` vs `bytes.Equal` to not leak timing information for comparison
750754
return hmac.Equal(key, encoded), nil
751755
}
@@ -757,7 +761,10 @@ func hashReplaceToken(token string, cfg config.PBKDF2) (string, error) {
757761
if err != nil {
758762
return "", errors.New("failed to generate random salt")
759763
}
760-
key := pbkdf2.Key([]byte(token), r, cfg.Iterations, cfg.KeyLength, sha512.New)
764+
key, err := pbkdf2.Key(sha512.New, token, r, cfg.Iterations, cfg.KeyLength)
765+
if err != nil {
766+
return "", fmt.Errorf("failed to create pbkdf2 key: %w", err)
767+
}
761768
salt := base64.RawStdEncoding.EncodeToString(r)
762769
encoded := base64.RawStdEncoding.EncodeToString(key)
763770
// format of stored replace_token

testing/go.mod

+6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
module github.com/elastic/fleet-server/testing
22

3+
<<<<<<< HEAD
34
go 1.22.10
45

56
toolchain go1.23.3
7+
=======
8+
go 1.24
9+
10+
toolchain go1.24.0
11+
>>>>>>> c2b8d66 (Update to go v1.24.0 (#4543))
612

713
replace (
814
github.com/elastic/fleet-server/pkg/api => ../pkg/api

0 commit comments

Comments
 (0)