linting: suppress false positive for G404 (gosec)

The linter falsely detects this as using "math/rand":

    libnetwork/networkdb/cluster.go:721:14: G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
       val, err := rand.Int(rand.Reader, big.NewInt(int64(n)))
                   ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-09-04 14:07:32 +02:00
parent a33d1f9a7c
commit 561a010161
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -718,7 +718,7 @@ func randomOffset(n int) int {
return 0
}
val, err := rand.Int(rand.Reader, big.NewInt(int64(n)))
val, err := rand.Int(rand.Reader, big.NewInt(int64(n))) // #nosec G404 -- False positive; see https://github.com/securego/gosec/issues/862
if err != nil {
logrus.Errorf("Failed to get a random offset: %v", err)
return 0