DevClad-Inc / devclad

Audit the random number generation source (rand) GSC-G404
Security
Minor
2 years ago2 years old
Use of weak random number generator (math/rand instead of crypto/rand)
108	json.Unmarshal(jsonString, &s3Response)
109
110	goddamnSource := rand.NewSource(time.Now().UnixNano())
111	r := rand.New(goddamnSource)112	randomNumber := r.Intn(len(s3Response.Contents))
113	randomImage := s3Response.Contents[randomNumber].Key
114	generatedURl := fmt.Sprintf("https://%s.r2.dev/%s", publicId, randomImage)