From 561a010161d20fa3367b6b7e9efefe04161c1291 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 4 Sep 2022 14:07:32 +0200 Subject: [PATCH] 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 --- libnetwork/networkdb/cluster.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnetwork/networkdb/cluster.go b/libnetwork/networkdb/cluster.go index 49b62faea0..879ff522da 100644 --- a/libnetwork/networkdb/cluster.go +++ b/libnetwork/networkdb/cluster.go @@ -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