errors.go: add Hash.Write() to the white list. (#648)

This commit is contained in:
エガオノキミヘ 2021-06-13 19:30:49 +08:00 committed by GitHub
parent e72b1e5f25
commit 3c230ac0f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,6 +86,7 @@ func NewNoErrorCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
whitelist.AddAll("fmt", "Print", "Printf", "Println", "Fprint", "Fprintf", "Fprintln") whitelist.AddAll("fmt", "Print", "Printf", "Println", "Fprint", "Fprintf", "Fprintln")
whitelist.AddAll("strings.Builder", "Write", "WriteByte", "WriteRune", "WriteString") whitelist.AddAll("strings.Builder", "Write", "WriteByte", "WriteRune", "WriteString")
whitelist.Add("io.PipeWriter", "CloseWithError") whitelist.Add("io.PipeWriter", "CloseWithError")
whitelist.Add("hash.Hash", "Write")
if configured, ok := conf["G104"]; ok { if configured, ok := conf["G104"]; ok {
if whitelisted, ok := configured.(map[string]interface{}); ok { if whitelisted, ok := configured.(map[string]interface{}); ok {