mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 03:55:54 +00:00
fix gofmt errors
This commit is contained in:
parent
15095a8bef
commit
66aea5cd99
2 changed files with 4 additions and 5 deletions
|
@ -31,7 +31,6 @@ func (r *readfile) ID() string {
|
|||
return r.MetaData.ID
|
||||
}
|
||||
|
||||
|
||||
// Match inspects AST nodes to determine if the match the methods `os.Open` or `ioutil.ReadFile`
|
||||
func (r *readfile) Match(n ast.Node, c *gas.Context) (*gas.Issue, error) {
|
||||
if node := r.ContainsCallExpr(n, c); node != nil {
|
||||
|
@ -50,14 +49,14 @@ func (r *readfile) Match(n ast.Node, c *gas.Context) (*gas.Issue, error) {
|
|||
// NewReadFile detects cases where we read files
|
||||
func NewReadFile(id string, conf gas.Config) (gas.Rule, []ast.Node) {
|
||||
rule := &readfile{
|
||||
CallList: gas.NewCallList(),
|
||||
CallList: gas.NewCallList(),
|
||||
MetaData: gas.MetaData{
|
||||
ID: id,
|
||||
What: "Potential file inclusion via variable",
|
||||
Severity: gas.Medium,
|
||||
Confidence: gas.High,
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
rule.Add("io/ioutil", "ReadFile")
|
||||
rule.Add("os", "Open")
|
||||
return rule, []ast.Node{(*ast.CallExpr)(nil)}
|
||||
|
|
|
@ -78,7 +78,7 @@ func Generate(filters ...RuleFilter) RuleList {
|
|||
{"G301", "Poor file permissions used when creating a directory", NewMkdirPerms},
|
||||
{"G302", "Poor file permisions used when creation file or using chmod", NewFilePerms},
|
||||
{"G303", "Creating tempfile using a predictable path", NewBadTempFile},
|
||||
{"G304", "File path provided as taint input", NewReadFile},
|
||||
{"G304", "File path provided as taint input", NewReadFile},
|
||||
|
||||
// crypto
|
||||
{"G401", "Detect the usage of DES, RC4, or MD5", NewUsesWeakCryptography},
|
||||
|
|
Loading…
Reference in a new issue