Skip to content

Commit f1bf4ad

Browse files
dependabot[bot]ldez
authored andcommitted
build(deps): bump github.com/securego/gosec/v2 from 2.8.1 to 2.9.1 (golangci#2299)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 7f95d36 commit f1bf4ad

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

.golangci.example.yml

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/config/linters_settings.go

Lines changed: 4 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)