From 68369752726a3b30e1d38d3801997516a40860b4 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 23 Dec 2020 18:01:03 +0300 Subject: [PATCH] [#275] innerring: Use crypto rand shuffle in audit Signed-off-by: Alex Vanin --- pkg/innerring/processors/audit/process.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/innerring/processors/audit/process.go b/pkg/innerring/processors/audit/process.go index 28e8301e2..5bd65998e 100644 --- a/pkg/innerring/processors/audit/process.go +++ b/pkg/innerring/processors/audit/process.go @@ -2,7 +2,6 @@ package audit import ( "context" - "math/rand" "time" "github.com/nspcc-dev/neofs-api-go/pkg/client" @@ -12,6 +11,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/services/audit" "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/storagegroup" + "github.com/nspcc-dev/neofs-node/pkg/util/rand" "go.uber.org/zap" ) @@ -66,9 +66,11 @@ func (ap *Processor) processStartAudit(epoch uint64) { continue } - // shuffle nodes to ask a random one n := nodes.Flatten() - rand.Shuffle(len(n), func(i, j int) { // fixme: consider using crypto rand + crand := rand.New() // math/rand with cryptographic source + + // shuffle nodes to ask a random one + crand.Shuffle(len(n), func(i, j int) { n[i], n[j] = n[j], n[i] })