Skip to content

Commit 6edca92

Browse files
build(deps): bump github.com/securego/gosec/v2 from 2.8.1 to 2.9.1 (#2299)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 680f3e6 commit 6edca92

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

.golangci.example.yml

+2
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ linters-settings:
369369
# Available rules: https://github.com/securego/gosec#available-rules
370370
excludes:
371371
- G204
372+
# Exclude generated files
373+
exclude-generated: true
372374
# To specify the configuration of rules.
373375
# The configuration of rules is not fully documented by gosec:
374376
# https://github.com/securego/gosec#configuration

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ require (
6565
github.com/ryancurrah/gomodguard v1.2.3
6666
github.com/ryanrolds/sqlclosecheck v0.3.0
6767
github.com/sanposhiho/wastedassign/v2 v2.0.6
68-
github.com/securego/gosec/v2 v2.8.1
68+
github.com/securego/gosec/v2 v2.9.1
6969
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
7070
github.com/shirou/gopsutil/v3 v3.21.9
7171
github.com/sirupsen/logrus v1.8.1

go.sum

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/config/linters_settings.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,10 @@ type GoModGuardSettings struct {
294294
}
295295

296296
type GoSecSettings struct {
297-
Includes []string
298-
Excludes []string
299-
Config map[string]interface{} `mapstructure:"config"`
297+
Includes []string
298+
Excludes []string
299+
ExcludeGenerated bool `mapstructure:"exclude-generated"`
300+
Config map[string]interface{} `mapstructure:"config"`
300301
}
301302

302303
type GovetSettings struct {

pkg/golinters/gosec.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func NewGosec(settings *config.GoSecSettings) *goanalysis.Linter {
5454
nil,
5555
).WithContextSetter(func(lintCtx *linter.Context) {
5656
analyzer.Run = func(pass *analysis.Pass) (interface{}, error) {
57-
gosecAnalyzer := gosec.NewAnalyzer(gasConfig, true, logger)
57+
gosecAnalyzer := gosec.NewAnalyzer(gasConfig, true, settings.ExcludeGenerated, logger)
5858
gosecAnalyzer.LoadRules(ruleDefinitions.Builders())
5959

6060
pkg := &packages.Package{

test/testdata/gosec.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ func GosecG204SubprocWithFunc() {
3434
return "/tmp/dummy"
3535
}
3636

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

0 commit comments

Comments
 (0)