Skip to content

Commit c2b8d66

Browse files
Update to go v1.24.0 (#4543)
Update to go v1.24.0, change golang.org/x/crypto/pbkdf2 to crypto/pbkdf2
1 parent 63b6b92 commit c2b8d66

File tree

9 files changed

+87
-47
lines changed

9 files changed

+87
-47
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

+37-37
Original file line numberDiff line numberDiff line change
@@ -5033,43 +5033,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
50335033
THE SOFTWARE.
50345034

50355035

5036-
--------------------------------------------------------------------------------
5037-
Dependency : golang.org/x/crypto
5038-
Version: v0.33.0
5039-
Licence type (autodetected): BSD-3-Clause
5040-
--------------------------------------------------------------------------------
5041-
5042-
Contents of probable licence file $GOMODCACHE/golang.org/x/crypto@v0.33.0/LICENSE:
5043-
5044-
Copyright 2009 The Go Authors.
5045-
5046-
Redistribution and use in source and binary forms, with or without
5047-
modification, are permitted provided that the following conditions are
5048-
met:
5049-
5050-
* Redistributions of source code must retain the above copyright
5051-
notice, this list of conditions and the following disclaimer.
5052-
* Redistributions in binary form must reproduce the above
5053-
copyright notice, this list of conditions and the following disclaimer
5054-
in the documentation and/or other materials provided with the
5055-
distribution.
5056-
* Neither the name of Google LLC nor the names of its
5057-
contributors may be used to endorse or promote products derived from
5058-
this software without specific prior written permission.
5059-
5060-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5061-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5062-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
5063-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
5064-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
5065-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
5066-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5067-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5068-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5069-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5070-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5071-
5072-
50735036
--------------------------------------------------------------------------------
50745037
Dependency : golang.org/x/sync
50755038
Version: v0.11.0
@@ -20082,6 +20045,43 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2008220045
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2008320046

2008420047

20048+
--------------------------------------------------------------------------------
20049+
Dependency : golang.org/x/crypto
20050+
Version: v0.33.0
20051+
Licence type (autodetected): BSD-3-Clause
20052+
--------------------------------------------------------------------------------
20053+
20054+
Contents of probable licence file $GOMODCACHE/golang.org/x/crypto@v0.33.0/LICENSE:
20055+
20056+
Copyright 2009 The Go Authors.
20057+
20058+
Redistribution and use in source and binary forms, with or without
20059+
modification, are permitted provided that the following conditions are
20060+
met:
20061+
20062+
* Redistributions of source code must retain the above copyright
20063+
notice, this list of conditions and the following disclaimer.
20064+
* Redistributions in binary form must reproduce the above
20065+
copyright notice, this list of conditions and the following disclaimer
20066+
in the documentation and/or other materials provided with the
20067+
distribution.
20068+
* Neither the name of Google LLC nor the names of its
20069+
contributors may be used to endorse or promote products derived from
20070+
this software without specific prior written permission.
20071+
20072+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20073+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20074+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20075+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20076+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20077+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20078+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20079+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20080+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20081+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
20082+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20083+
20084+
2008520085
--------------------------------------------------------------------------------
2008620086
Dependency : golang.org/x/mod
2008720087
Version: v0.23.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

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

3-
go 1.23
3+
go 1.24
44

55
require (
66
github.com/Pallinder/go-randomdata v1.2.0
@@ -35,7 +35,6 @@ require (
3535
go.elastic.co/apm/v2 v2.6.3
3636
go.elastic.co/ecszerolog v0.2.0
3737
go.uber.org/zap v1.27.0
38-
golang.org/x/crypto v0.33.0
3938
golang.org/x/sync v0.11.0
4039
golang.org/x/time v0.5.0
4140
google.golang.org/grpc v1.63.2
@@ -89,6 +88,7 @@ require (
8988
go.opentelemetry.io/otel/metric v1.28.0 // indirect
9089
go.opentelemetry.io/otel/trace v1.28.0 // indirect
9190
go.uber.org/multierr v1.11.0 // indirect
91+
golang.org/x/crypto v0.33.0 // indirect
9292
golang.org/x/mod v0.23.0 // indirect
9393
golang.org/x/net v0.35.0 // indirect
9494
golang.org/x/sys v0.30.0 // 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

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

3-
go 1.23
3+
go 1.24
44

5-
toolchain go1.23.2
5+
toolchain go1.24.0
66

77
replace (
88
github.com/elastic/fleet-server/pkg/api => ../pkg/api

0 commit comments

Comments
 (0)