Lint: Fix broken / missing nosec / nolint comments

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-09-06 00:35:20 +02:00
parent 7fa2c2e4b6
commit e259ca209c
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
3 changed files with 5 additions and 5 deletions

View file

@ -22,7 +22,7 @@ func randomString(lst ...string) (string, error) {
return "", errors.New("empty list given") return "", errors.New("empty list given")
} }
return lst[rand.Intn(len(lst))], nil return lst[rand.Intn(len(lst))], nil // #nosec:G404 // This is used to select a random string from a list, no crypto-use
} }
func stableRandomFromSeed(seed string) (float64, error) { func stableRandomFromSeed(seed string) (float64, error) {
@ -31,11 +31,11 @@ func stableRandomFromSeed(seed string) (float64, error) {
return 0, errors.Wrap(err, "generating seed") return 0, errors.Wrap(err, "generating seed")
} }
return rand.New(rand.NewSource(seedValue)).Float64(), nil // #nosec G404 // Only used for generating a random number from static string, no need for cryptographic safety return rand.New(rand.NewSource(seedValue)).Float64(), nil // #nosec:G404 // Only used for generating a random number from static string, no need for cryptographic safety
} }
func stringToSeed(s string) (int64, error) { func stringToSeed(s string) (int64, error) {
hash := md5.New() // #nosec G401 // Unly used to convert a string into a numer, no need for cryptographic safety hash := md5.New() // #nosec:G401 // Unly used to convert a string into a numer, no need for cryptographic safety
if _, err := fmt.Fprint(hash, s); err != nil { if _, err := fmt.Fprint(hash, s); err != nil {
return 0, errors.Wrap(err, "writing string to hasher") return 0, errors.Wrap(err, "writing string to hasher")
} }