From 345108314b5231dd3c96d5a6a4a5039509f8afd9 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Sun, 23 Feb 2020 09:54:02 +0100 Subject: [PATCH] feat: use secure rand seed --- go/cmd/pathwar/main.go | 3 ++- go/go.mod | 1 + go/go.sum | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go/cmd/pathwar/main.go b/go/cmd/pathwar/main.go index 99a54047e..ed54032ac 100644 --- a/go/cmd/pathwar/main.go +++ b/go/cmd/pathwar/main.go @@ -24,6 +24,7 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" "golang.org/x/oauth2" + "moul.io/srand" "pathwar.land/go/v2/pkg/errcode" "pathwar.land/go/v2/pkg/pwagent" "pathwar.land/go/v2/pkg/pwapi" @@ -653,7 +654,7 @@ func ssoFromFlags() (pwsso.Client, error) { } func globalPreRun() error { - rand.Seed(time.Now().UnixNano()) + rand.Seed(srand.Secure()) if globalDebug { config := zap.NewDevelopmentConfig() config.Level.SetLevel(zap.DebugLevel) diff --git a/go/go.mod b/go/go.mod index 80e9bdf67..feee8d2df 100644 --- a/go/go.mod +++ b/go/go.mod @@ -50,6 +50,7 @@ require ( gopkg.in/yaml.v2 v2.2.7 // indirect gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2 moul.io/godev v1.3.0 + moul.io/srand v1.4.0 moul.io/zapgorm v1.0.0 ) diff --git a/go/go.sum b/go/go.sum index b32de024b..b913a5d33 100644 --- a/go/go.sum +++ b/go/go.sum @@ -383,5 +383,7 @@ honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXe honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= moul.io/godev v1.3.0 h1:+GGk+scZhZ4citKb/lLubV/QJsu7OvB5UZhSYNQRCx4= moul.io/godev v1.3.0/go.mod h1:xsV3hXF1E9vy2T/1b1CLjSImJ1/nQeTfqTDhJHhJCWg= +moul.io/srand v1.4.0 h1:r5ZMiWDN0ni0lTV7KzJR/jx0K7GivJYW5WaXmufgeik= +moul.io/srand v1.4.0/go.mod h1:P2uaZB+GFstFNo8sEj6/U8FRV1n25kD0LLckFpJ+qvc= moul.io/zapgorm v1.0.0 h1:HpO9x1TmsKFd4JoLNHrSIc1uZn6kmyDxLQK4xjfz8JE= moul.io/zapgorm v1.0.0/go.mod h1:JDE3xz5BQ1ccnAijE5+T8Qin6T256Bw2Cpdi+qMfWgw=