Skip to content

Commit

Permalink
build(deps): bump github.com/securego/gosec/v2 from 2.8.1 to 2.9.1 (#…
Browse files Browse the repository at this point in the history
…2299)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
  • Loading branch information
dependabot[bot] and ldez committed Oct 18, 2021
1 parent 680f3e6 commit 6edca92
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .golangci.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ linters-settings:
# Available rules: https://github.com/securego/gosec#available-rules
excludes:
- G204
# Exclude generated files
exclude-generated: true
# To specify the configuration of rules.
# The configuration of rules is not fully documented by gosec:
# https://github.com/securego/gosec#configuration
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ require (
github.com/ryancurrah/gomodguard v1.2.3
github.com/ryanrolds/sqlclosecheck v0.3.0
github.com/sanposhiho/wastedassign/v2 v2.0.6
github.com/securego/gosec/v2 v2.8.1
github.com/securego/gosec/v2 v2.9.1
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
github.com/shirou/gopsutil/v3 v3.21.9
github.com/sirupsen/logrus v1.8.1
Expand Down
14 changes: 7 additions & 7 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,10 @@ type GoModGuardSettings struct {
}

type GoSecSettings struct {
Includes []string
Excludes []string
Config map[string]interface{} `mapstructure:"config"`
Includes []string
Excludes []string
ExcludeGenerated bool `mapstructure:"exclude-generated"`
Config map[string]interface{} `mapstructure:"config"`
}

type GovetSettings struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/gosec.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewGosec(settings *config.GoSecSettings) *goanalysis.Linter {
nil,
).WithContextSetter(func(lintCtx *linter.Context) {
analyzer.Run = func(pass *analysis.Pass) (interface{}, error) {
gosecAnalyzer := gosec.NewAnalyzer(gasConfig, true, logger)
gosecAnalyzer := gosec.NewAnalyzer(gasConfig, true, settings.ExcludeGenerated, logger)
gosecAnalyzer.LoadRules(ruleDefinitions.Builders())

pkg := &packages.Package{
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/gosec.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ func GosecG204SubprocWithFunc() {
return "/tmp/dummy"
}

exec.Command("ls", arg()).Run() // ERROR "G204: Subprocess launched with function call as argument or cmd arguments"
exec.Command("ls", arg()).Run() // ERROR "G204: Subprocess launched with a potential tainted input or cmd arguments"
}

0 comments on commit 6edca92

Please sign in to comment.