Skip to content

G404 while using math/rand/v2 #1241

Closed
Closed
@ldemailly

Description

@ldemailly

Summary

fire.go:92:51: G404: Use of weak random number generator (math/rand or math/rand/v2 instead of crypto/rand) (gosec)

that's with golanglint-ci, or directly:

[/Users/dl/dev/fortio.org/terminal/fps/fire.go:92] - G404 (CWE-338): Use of weak random number generator (math/rand or math/rand/v2 instead of crypto/rand) (Confidence: MEDIUM, Severity: HIGH)

even though I am importing "math/rand/v2"

Steps to reproduce the behavior

I have seen this almost everywhere but for instance

https://github.com/fortio/terminal/blob/58d343f9c7e65b59f2dd37cbf6e15d958e74ba82/brick/brick.go#L89

gosec version

latest from master

Go version (output of 'go version')

go version go1.22.8 darwin/arm64

Operating system / Environment

macOS

Expected behavior

no complaint when using rand/v2

Actual behavior

complaints

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions