Skip to content

Commit

Permalink
Merge pull request pathwar#424 from pathwar/dev/moul/secure-srand
Browse files Browse the repository at this point in the history
feat: use secure rand seed
  • Loading branch information
moul authored Feb 23, 2020
2 parents ad90645 + 3451083 commit 8e3ec74
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion go/cmd/pathwar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
2 changes: 2 additions & 0 deletions go/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8e3ec74

Please sign in to comment.