Skip to content

Commit

Permalink
fix: unsecure rand
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Jul 6, 2023
1 parent 2d23bdd commit cff7aaf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/hex"
"fmt"
"math/rand"
mrand "math/rand"
"path/filepath"
"sync"
Expand Down Expand Up @@ -140,6 +139,8 @@ func (opts *Opts) applyDefaults(ctx context.Context) error {
opts.Logger = zap.NewNop()
}

rng := mrand.New(mrand.NewSource(srand.MustSecure())) // nolint:gosec // we need to use math/rand here, but it is seeded from crypto/rand

opts.applyDefaultsGetDatastore()

if err := opts.applyPushDefaults(); err != nil {
Expand Down Expand Up @@ -198,7 +199,6 @@ func (opts *Opts) applyDefaults(ctx context.Context) error {

// setup default tinder service
if opts.TinderService == nil {
rng := mrand.New(mrand.NewSource(srand.MustSecure())) // nolint:gosec // we need to use math/rand here, but it is seeded from crypto/rand
drivers := []tinder.IDriver{}

// setup loac disc
Expand All @@ -222,7 +222,6 @@ func (opts *Opts) applyDefaults(ctx context.Context) error {
if opts.PubSub == nil {
var err error

rng := rand.New(rand.NewSource(time.Now().UnixNano()))
popts := []pubsub_fix.Option{
pubsub_fix.WithMessageSigning(true),
pubsub_fix.WithPeerExchange(true),
Expand Down

0 comments on commit cff7aaf

Please sign in to comment.