From 5da09f0c23f272720cbf7f64a673945a87d39587 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Wed, 1 Feb 2023 10:11:56 +0000 Subject: [PATCH] lint: enable gosec Signed-off-by: Justin Chadwell --- .golangci.yml | 7 +++++++ driver/kubernetes/podchooser/podchooser.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 177f18f1..b5a7e9ae 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,6 +22,7 @@ linters: - staticcheck - typecheck - nolintlint + - gosec disable-all: true linters-settings: @@ -32,6 +33,12 @@ linters-settings: # The io/ioutil package has been deprecated. # https://go.dev/doc/go1.16#ioutil - io/ioutil + gosec: + excludes: + - G204 # Audit use of command execution + - G402 # TLS MinVersion too low + config: + G306: "0644" issues: exclude-rules: diff --git a/driver/kubernetes/podchooser/podchooser.go b/driver/kubernetes/podchooser/podchooser.go index 059d0aec..06a29441 100644 --- a/driver/kubernetes/podchooser/podchooser.go +++ b/driver/kubernetes/podchooser/podchooser.go @@ -37,7 +37,7 @@ func (pc *RandomPodChooser) ChoosePod(ctx context.Context) (*corev1.Pod, error) if randSource == nil { randSource = rand.NewSource(time.Now().Unix()) } - rnd := rand.New(randSource) + rnd := rand.New(randSource) //nolint:gosec // no strong seeding required n := rnd.Int() % len(pods) logrus.Debugf("RandomPodChooser.ChoosePod(): len(pods)=%d, n=%d", len(pods), n) return pods[n], nil