1
0
mirror of https://github.com/securego/gosec.git synced 2025-06-14 23:45:03 +02:00

G303: catch with os.WriteFile, add os.Create test case (#718)

* Add G303 os.Create test case

* Catch G303 with os.WriteFile too
This commit is contained in:
Ville Skyttä
2021-11-09 22:13:45 +02:00
committed by GitHub
parent 873ac243ea
commit 40fa36d1de
2 changed files with 13 additions and 2 deletions

View File

@ -44,7 +44,7 @@ func (t *badTempFile) Match(n ast.Node, c *gosec.Context) (gi *gosec.Issue, err
func NewBadTempFile(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
calls := gosec.NewCallList()
calls.Add("io/ioutil", "WriteFile")
calls.Add("os", "Create")
calls.AddAll("os", "Create", "WriteFile")
return &badTempFile{
calls: calls,
args: regexp.MustCompile(`^/tmp/.*$|^/var/tmp/.*$`),