1
0
mirror of https://github.com/securego/gosec.git synced 2025-11-23 22:15:04 +02:00
Files
gosec/testutils/g501_samples.go
Matthew Hartstonge 10cf58a4a4 fix: build tag parsing. (#1413)
* fix: build tag parsing.

* chore: lint fixes.
2025-11-05 10:46:27 +01:00

47 lines
684 B
Go

package testutils
import "github.com/securego/gosec/v2"
// SampleCodeG501 - Blocklisted import MD5
var (
SampleCodeG501 = []CodeSample{
{[]string{`
package main
import (
"crypto/md5"
"fmt"
"os"
)
func main() {
for _, arg := range os.Args {
fmt.Printf("%x - %s\n", md5.Sum([]byte(arg)), arg)
}
}
`}, 1, gosec.NewConfig()},
}
// SampleCodeG501BuildTag provides a reportable file if a build tag is
// supplied.
SampleCodeG501BuildTag = []CodeSample{
{[]string{`
//go:build tag
package main
import (
"crypto/md5"
"fmt"
"os"
)
func main() {
for _, arg := range os.Args {
fmt.Printf("%x - %s\n", md5.Sum([]byte(arg)), arg)
}
}
`}, 2, gosec.NewConfig()},
}
)