Skip to content

Commit

Permalink
[Chore] Fix golangci-lint rule: gosec (#2163)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortalHappiness committed Jun 17, 2024
1 parent 8453f9b commit 41c9e91
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion ray-operator/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
linters-settings:
gofmt:
simplify: true
gosec:
excludes:
- G601
ginkgolinter:
forbid-focus-container: true
goimports:
Expand Down Expand Up @@ -62,7 +65,7 @@ linters:
- gofmt
- gofumpt
- goimports
# - gosec
- gosec
- gosimple
# - govet
- ineffassign
Expand Down
6 changes: 5 additions & 1 deletion ray-operator/apis/ray/v1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ var _ = BeforeSuite(func() {
dialer := &net.Dialer{Timeout: time.Second}
addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort)
Eventually(func() error {
conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true})
conn, err := tls.DialWithDialer(dialer,
"tcp",
addrPort,
&tls.Config{InsecureSkipVerify: true}, //nolint:gosec // Allow InsecureSkipVerify because we are connecting to our own webhook server.
)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions ray-operator/controllers/ray/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package utils

import (
"context"
"crypto/sha1"
"crypto/sha1" //nolint:gosec // We are not using this for security purposes
"encoding/base32"
"fmt"
"math"
Expand Down Expand Up @@ -470,7 +470,7 @@ func GenerateJsonHash(obj interface{}) (string, error) {
return "", err
}

hashBytes := sha1.Sum(serialObj)
hashBytes := sha1.Sum(serialObj) //nolint:gosec // We are not using this for security purposes

// Convert to an ASCII string
hashStr := base32.HexEncoding.EncodeToString(hashBytes[:])
Expand Down

0 comments on commit 41c9e91

Please sign in to comment.