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>
(cherry picked from commit 561a010161)
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 ff4ec67b90
commit 188c5d4a7c
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 1 additions and 1 deletions

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