mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
Add more tests samples to increase coverage
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
fe07fcf276
commit
0c1a71b8a1
1 changed files with 23 additions and 2 deletions
|
@ -1891,13 +1891,15 @@ import "crypto/rand"
|
|||
func main() {
|
||||
good, _ := rand.Read(nil)
|
||||
println(good)
|
||||
}`}, 0, gosec.NewConfig()}, {[]string{`
|
||||
}`}, 0, gosec.NewConfig()},
|
||||
{[]string{`
|
||||
package main
|
||||
import "math/rand"
|
||||
func main() {
|
||||
bad := rand.Int()
|
||||
println(bad)
|
||||
}`}, 1, gosec.NewConfig()}, {[]string{`
|
||||
}`}, 1, gosec.NewConfig()},
|
||||
{[]string{`
|
||||
package main
|
||||
import (
|
||||
"crypto/rand"
|
||||
|
@ -1908,6 +1910,25 @@ func main() {
|
|||
println(good)
|
||||
bad := mrand.Int31()
|
||||
println(bad)
|
||||
}`}, 1, gosec.NewConfig()},
|
||||
{[]string{`
|
||||
package main
|
||||
import (
|
||||
"math/rand"
|
||||
)
|
||||
func main() {
|
||||
gen := rand.New(rand.NewSource(10.4))
|
||||
bad := gen.Int()
|
||||
println(bad)
|
||||
}`}, 1, gosec.NewConfig()},
|
||||
{[]string{`
|
||||
package main
|
||||
import (
|
||||
"math/rand"
|
||||
)
|
||||
func main() {
|
||||
bad := rand.Intn(10)
|
||||
println(bad)
|
||||
}`}, 1, gosec.NewConfig()}}
|
||||
|
||||
// SampleCodeG501 - Blacklisted import MD5
|
||||
|
|
Loading…
Reference in a new issue