mirror of
https://github.com/securego/gosec.git
synced 2025-11-23 22:15:04 +02:00
feat: add os.ReadFile to G304 (#706)
In Go 1.16 or higher, the `io/ioutil` has been deprecated and the `ioutil.ReadFile` function now calls `os.ReadFile`. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -122,6 +122,7 @@ func NewReadFile(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
|
||||
rule.clean.Add("path/filepath", "Clean")
|
||||
rule.clean.Add("path/filepath", "Rel")
|
||||
rule.Add("io/ioutil", "ReadFile")
|
||||
rule.Add("os", "ReadFile")
|
||||
rule.Add("os", "Open")
|
||||
rule.Add("os", "OpenFile")
|
||||
return rule, []ast.Node{(*ast.CallExpr)(nil)}
|
||||
|
||||
Reference in New Issue
Block a user