dependabot[bot] 6edca924d3
build(deps): bump github.com/securego/gosec/v2 from 2.8.1 to 2.9.1 (#2299)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2021-10-19 00:20:49 +02:00

39 lines
701 B
Go

//args: -Egosec
package testdata
import (
"crypto/md5" // ERROR "G501: Blocklisted import crypto/md5: weak cryptographic primitive"
"fmt"
"log"
"os"
"os/exec"
)
func Gosec() {
h := md5.New() // ERROR "G401: Use of weak cryptographic primitive"
log.Print(h)
}
func GosecNolintGas() {
h := md5.New() //nolint:gas
log.Print(h)
}
func GosecNolintGosec() {
h := md5.New() //nolint:gosec
log.Print(h)
}
func GosecNoErrorCheckingByDefault() {
f, _ := os.Create("foo")
fmt.Println(f)
}
func GosecG204SubprocWithFunc() {
arg := func() string {
return "/tmp/dummy"
}
exec.Command("ls", arg()).Run() // ERROR "G204: Subprocess launched with a potential tainted input or cmd arguments"
}