mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +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() {
|
func main() {
|
||||||
good, _ := rand.Read(nil)
|
good, _ := rand.Read(nil)
|
||||||
println(good)
|
println(good)
|
||||||
}`}, 0, gosec.NewConfig()}, {[]string{`
|
}`}, 0, gosec.NewConfig()},
|
||||||
|
{[]string{`
|
||||||
package main
|
package main
|
||||||
import "math/rand"
|
import "math/rand"
|
||||||
func main() {
|
func main() {
|
||||||
bad := rand.Int()
|
bad := rand.Int()
|
||||||
println(bad)
|
println(bad)
|
||||||
}`}, 1, gosec.NewConfig()}, {[]string{`
|
}`}, 1, gosec.NewConfig()},
|
||||||
|
{[]string{`
|
||||||
package main
|
package main
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
@ -1908,6 +1910,25 @@ func main() {
|
||||||
println(good)
|
println(good)
|
||||||
bad := mrand.Int31()
|
bad := mrand.Int31()
|
||||||
println(bad)
|
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()}}
|
}`}, 1, gosec.NewConfig()}}
|
||||||
|
|
||||||
// SampleCodeG501 - Blacklisted import MD5
|
// SampleCodeG501 - Blacklisted import MD5
|
||||||
|
|
Loading…
Reference in a new issue