Skip to content

Commit 6a73248

Browse files
committed
Fix some linting warnings
1 parent 83fc5e6 commit 6a73248

26 files changed

+58
-60
lines changed

helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func GetCallInfo(n ast.Node, ctx *Context) (string, string, error) {
182182
}
183183

184184
// GetCallStringArgsValues returns the values of strings arguments if they can be resolved
185-
func GetCallStringArgsValues(n ast.Node, ctx *Context) []string {
185+
func GetCallStringArgsValues(n ast.Node, _ *Context) []string {
186186
values := []string{}
187187
switch node := n.(type) {
188188
case *ast.CallExpr:

import_tracker.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ func (t *ImportTracker) TrackPackages(pkgs ...*types.Package) {
5151
func (t *ImportTracker) TrackImport(imported *ast.ImportSpec) {
5252
importPath := strings.Trim(imported.Path.Value, `"`)
5353
if imported.Name != nil {
54-
if imported.Name.Name == "_" {
55-
// Initialization only import
56-
} else {
54+
if imported.Name.Name != "_" {
5755
// Aliased import
5856
t.Imported[importPath] = append(t.Imported[importPath], imported.Name.String())
5957
}

report/formatter_test.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,10 @@ var _ = Describe("Formatter", func() {
288288
for _, rule := range grules {
289289
cwe := issue.GetCweByRule(rule)
290290
newissue := createIssue(rule, cwe)
291-
error := map[string][]gosec.Error{}
291+
errors := map[string][]gosec.Error{}
292292

293293
buf := new(bytes.Buffer)
294-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, error)
294+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, errors)
295295
err := CreateReport(buf, "csv", false, []string{}, reportInfo)
296296
Expect(err).ShouldNot(HaveOccurred())
297297
pattern := "/home/src/project/test.go,1,test,HIGH,HIGH,1: testcode,CWE-%s\n"
@@ -303,10 +303,10 @@ var _ = Describe("Formatter", func() {
303303
for _, rule := range grules {
304304
cwe := issue.GetCweByRule(rule)
305305
newissue := createIssue(rule, cwe)
306-
error := map[string][]gosec.Error{}
306+
errors := map[string][]gosec.Error{}
307307

308308
buf := new(bytes.Buffer)
309-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{NumFiles: 0, NumLines: 0, NumNosec: 0, NumFound: 0}, error).WithVersion("v2.7.0")
309+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{NumFiles: 0, NumLines: 0, NumNosec: 0, NumFound: 0}, errors).WithVersion("v2.7.0")
310310
err := CreateReport(buf, "xml", false, []string{}, reportInfo)
311311
Expect(err).ShouldNot(HaveOccurred())
312312
pattern := "Results:\n\n\n[/home/src/project/test.go:1] - %s (CWE-%s): test (Confidence: HIGH, Severity: HIGH)\n > 1: testcode\n\n\n\nSummary:\n Gosec : v2.7.0\n Files : 0\n Lines : 0\n Nosec : 0\n Issues : 0\n\n"
@@ -318,7 +318,7 @@ var _ = Describe("Formatter", func() {
318318
for _, rule := range grules {
319319
cwe := issue.GetCweByRule(rule)
320320
newissue := createIssue(rule, cwe)
321-
error := map[string][]gosec.Error{}
321+
errors := map[string][]gosec.Error{}
322322

323323
data := createReportInfo(rule, cwe)
324324

@@ -327,7 +327,7 @@ var _ = Describe("Formatter", func() {
327327
err := enc.Encode(data)
328328
Expect(err).ShouldNot(HaveOccurred())
329329
buf := new(bytes.Buffer)
330-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, error)
330+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, errors)
331331
err = CreateReport(buf, "json", false, []string{}, reportInfo)
332332
Expect(err).ShouldNot(HaveOccurred())
333333
result := stripString(buf.String())
@@ -339,7 +339,7 @@ var _ = Describe("Formatter", func() {
339339
for _, rule := range grules {
340340
cwe := issue.GetCweByRule(rule)
341341
newissue := createIssue(rule, cwe)
342-
error := map[string][]gosec.Error{}
342+
errors := map[string][]gosec.Error{}
343343

344344
data := createReportInfo(rule, cwe)
345345

@@ -348,7 +348,7 @@ var _ = Describe("Formatter", func() {
348348
err := enc.Encode(data)
349349
Expect(err).ShouldNot(HaveOccurred())
350350
buf := new(bytes.Buffer)
351-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, error)
351+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, errors)
352352
err = CreateReport(buf, "html", false, []string{}, reportInfo)
353353
Expect(err).ShouldNot(HaveOccurred())
354354
result := stripString(buf.String())
@@ -360,7 +360,7 @@ var _ = Describe("Formatter", func() {
360360
for _, rule := range grules {
361361
cwe := issue.GetCweByRule(rule)
362362
newissue := createIssue(rule, cwe)
363-
error := map[string][]gosec.Error{}
363+
errors := map[string][]gosec.Error{}
364364

365365
data := createReportInfo(rule, cwe)
366366

@@ -369,7 +369,7 @@ var _ = Describe("Formatter", func() {
369369
err := enc.Encode(data)
370370
Expect(err).ShouldNot(HaveOccurred())
371371
buf := new(bytes.Buffer)
372-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, error)
372+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, errors)
373373
err = CreateReport(buf, "yaml", false, []string{}, reportInfo)
374374
Expect(err).ShouldNot(HaveOccurred())
375375
result := stripString(buf.String())
@@ -381,7 +381,7 @@ var _ = Describe("Formatter", func() {
381381
for _, rule := range grules {
382382
cwe := issue.GetCweByRule(rule)
383383
newissue := createIssue(rule, cwe)
384-
error := map[string][]gosec.Error{}
384+
errors := map[string][]gosec.Error{}
385385

386386
data := createReportInfo(rule, cwe)
387387

@@ -390,7 +390,7 @@ var _ = Describe("Formatter", func() {
390390
err := enc.Encode(data)
391391
Expect(err).ShouldNot(HaveOccurred())
392392
buf := new(bytes.Buffer)
393-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, error)
393+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, errors)
394394
err = CreateReport(buf, "junit-xml", false, []string{}, reportInfo)
395395
Expect(err).ShouldNot(HaveOccurred())
396396
expectation := stripString(fmt.Sprintf("[/home/src/project/test.go:1] - test (Confidence: 2, Severity: 2, CWE: %s)", cwe.ID))
@@ -402,7 +402,7 @@ var _ = Describe("Formatter", func() {
402402
for _, rule := range grules {
403403
cwe := issue.GetCweByRule(rule)
404404
newissue := createIssue(rule, cwe)
405-
error := map[string][]gosec.Error{}
405+
errors := map[string][]gosec.Error{}
406406

407407
data := createReportInfo(rule, cwe)
408408

@@ -411,7 +411,7 @@ var _ = Describe("Formatter", func() {
411411
err := enc.Encode(data)
412412
Expect(err).ShouldNot(HaveOccurred())
413413
buf := new(bytes.Buffer)
414-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, error)
414+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, errors)
415415
err = CreateReport(buf, "text", false, []string{}, reportInfo)
416416
Expect(err).ShouldNot(HaveOccurred())
417417
expectation := stripString(fmt.Sprintf("[/home/src/project/test.go:1] - %s (CWE-%s): test (Confidence: HIGH, Severity: HIGH)", rule, cwe.ID))
@@ -423,9 +423,9 @@ var _ = Describe("Formatter", func() {
423423
for _, rule := range grules {
424424
cwe := issue.GetCweByRule(rule)
425425
newissue := createIssue(rule, cwe)
426-
error := map[string][]gosec.Error{}
426+
errors := map[string][]gosec.Error{}
427427
buf := new(bytes.Buffer)
428-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, error)
428+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, errors)
429429
err := CreateReport(buf, "sonarqube", false, []string{"/home/src/project"}, reportInfo)
430430
Expect(err).ShouldNot(HaveOccurred())
431431

@@ -444,10 +444,10 @@ var _ = Describe("Formatter", func() {
444444
for _, rule := range grules {
445445
cwe := issue.GetCweByRule(rule)
446446
newissue := createIssue(rule, cwe)
447-
error := map[string][]gosec.Error{}
447+
errors := map[string][]gosec.Error{}
448448

449449
buf := new(bytes.Buffer)
450-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, error)
450+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, errors)
451451
err := CreateReport(buf, "golint", false, []string{}, reportInfo)
452452
Expect(err).ShouldNot(HaveOccurred())
453453
pattern := "/home/src/project/test.go:1:1: [CWE-%s] test (Rule:%s, Severity:HIGH, Confidence:HIGH)\n"
@@ -459,10 +459,10 @@ var _ = Describe("Formatter", func() {
459459
for _, rule := range grules {
460460
cwe := issue.GetCweByRule(rule)
461461
newissue := createIssue(rule, cwe)
462-
error := map[string][]gosec.Error{}
462+
errors := map[string][]gosec.Error{}
463463

464464
buf := new(bytes.Buffer)
465-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, error).WithVersion("v2.7.0")
465+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&newissue}, &gosec.Metrics{}, errors).WithVersion("v2.7.0")
466466
err := CreateReport(buf, "sarif", false, []string{}, reportInfo)
467467
Expect(err).ShouldNot(HaveOccurred())
468468

@@ -502,8 +502,8 @@ var _ = Describe("Formatter", func() {
502502
suppressedIssue.WithSuppressions(suppressions)
503503

504504
It("text formatted report should contain the suppressed issues", func() {
505-
error := map[string][]gosec.Error{}
506-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&suppressedIssue}, &gosec.Metrics{}, error)
505+
errors := map[string][]gosec.Error{}
506+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&suppressedIssue}, &gosec.Metrics{}, errors)
507507

508508
buf := new(bytes.Buffer)
509509
err := CreateReport(buf, "text", false, []string{}, reportInfo)
@@ -514,8 +514,8 @@ var _ = Describe("Formatter", func() {
514514
})
515515

516516
It("sarif formatted report should contain the suppressed issues", func() {
517-
error := map[string][]gosec.Error{}
518-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&suppressedIssue}, &gosec.Metrics{}, error)
517+
errors := map[string][]gosec.Error{}
518+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&suppressedIssue}, &gosec.Metrics{}, errors)
519519

520520
buf := new(bytes.Buffer)
521521
err := CreateReport(buf, "sarif", false, []string{}, reportInfo)
@@ -526,8 +526,8 @@ var _ = Describe("Formatter", func() {
526526
})
527527

528528
It("json formatted report should contain the suppressed issues", func() {
529-
error := map[string][]gosec.Error{}
530-
reportInfo := gosec.NewReportInfo([]*issue.Issue{&suppressedIssue}, &gosec.Metrics{}, error)
529+
errors := map[string][]gosec.Error{}
530+
reportInfo := gosec.NewReportInfo([]*issue.Issue{&suppressedIssue}, &gosec.Metrics{}, errors)
531531

532532
buf := new(bytes.Buffer)
533533
err := CreateReport(buf, "json", false, []string{}, reportInfo)

resolve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func resolveBinExpr(n *ast.BinaryExpr, c *Context) bool {
6666
return (TryResolve(n.X, c) && TryResolve(n.Y, c))
6767
}
6868

69-
func resolveCallExpr(n *ast.CallExpr, c *Context) bool {
69+
func resolveCallExpr(_ *ast.CallExpr, _ *Context) bool {
7070
// TODO(tkelsey): next step, full function resolution
7171
return false
7272
}

rules/archive.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (a *archive) Match(n ast.Node, c *gosec.Context) (*issue.Issue, error) {
4949
}
5050

5151
// NewArchive creates a new rule which detects the file traversal when extracting zip/tar archives
52-
func NewArchive(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
52+
func NewArchive(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
5353
calls := gosec.NewCallList()
5454
calls.Add("path/filepath", "Join")
5555
calls.Add("path", "Join")

rules/bind.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (r *bindsToAllNetworkInterfaces) Match(n ast.Node, c *gosec.Context) (*issu
6767

6868
// NewBindsToAllNetworkInterfaces detects socket connections that are setup to
6969
// listen on all network interfaces.
70-
func NewBindsToAllNetworkInterfaces(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
70+
func NewBindsToAllNetworkInterfaces(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
7171
calls := gosec.NewCallList()
7272
calls.Add("net", "Listen")
7373
calls.Add("crypto/tls", "Listen")

rules/blocklist.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ type blocklistedImport struct {
2828
}
2929

3030
func unquote(original string) string {
31-
copy := strings.TrimSpace(original)
32-
copy = strings.TrimLeft(copy, `"`)
33-
return strings.TrimRight(copy, `"`)
31+
cleaned := strings.TrimSpace(original)
32+
cleaned = strings.TrimLeft(cleaned, `"`)
33+
return strings.TrimRight(cleaned, `"`)
3434
}
3535

3636
func (r *blocklistedImport) ID() string {
@@ -48,7 +48,7 @@ func (r *blocklistedImport) Match(n ast.Node, c *gosec.Context) (*issue.Issue, e
4848

4949
// NewBlocklistedImports reports when a blocklisted import is being used.
5050
// Typically when a deprecated technology is being used.
51-
func NewBlocklistedImports(id string, conf gosec.Config, blocklist map[string]string) (gosec.Rule, []ast.Node) {
51+
func NewBlocklistedImports(id string, _ gosec.Config, blocklist map[string]string) (gosec.Rule, []ast.Node) {
5252
return &blocklistedImport{
5353
MetaData: issue.MetaData{
5454
ID: id,

rules/decompression-bomb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (d *decompressionBombCheck) Match(node ast.Node, ctx *gosec.Context) (*issu
8383
}
8484

8585
// NewDecompressionBombCheck detects if there is potential DoS vulnerability via decompression bomb
86-
func NewDecompressionBombCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
86+
func NewDecompressionBombCheck(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
8787
readerCalls := gosec.NewCallList()
8888
readerCalls.Add("compress/gzip", "NewReader")
8989
readerCalls.AddAll("compress/zlib", "NewReader", "NewReaderDict")

rules/directory-traversal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ func (r *traversal) matchCallExpr(assign *ast.CallExpr, ctx *gosec.Context) (*is
3030
if basiclit, ok1 := i.(*ast.BasicLit); ok1 {
3131
if fun, ok2 := assign.Fun.(*ast.SelectorExpr); ok2 {
3232
if x, ok3 := fun.X.(*ast.Ident); ok3 {
33-
string := x.Name + "." + fun.Sel.Name + "(" + basiclit.Value + ")"
34-
if r.pattern.MatchString(string) {
33+
str := x.Name + "." + fun.Sel.Name + "(" + basiclit.Value + ")"
34+
if r.pattern.MatchString(str) {
3535
return ctx.NewIssue(assign, r.ID(), r.What, r.Severity, r.Confidence), nil
3636
}
3737
}

rules/http_serve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (r *httpServeWithoutTimeouts) Match(n ast.Node, c *gosec.Context) (gi *issu
2525
}
2626

2727
// NewHTTPServeWithoutTimeouts detects use of net/http serve functions that have no support for setting timeouts.
28-
func NewHTTPServeWithoutTimeouts(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
28+
func NewHTTPServeWithoutTimeouts(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
2929
return &httpServeWithoutTimeouts{
3030
pkg: "net/http",
3131
calls: []string{"ListenAndServe", "ListenAndServeTLS", "Serve", "ServeTLS"},

rules/implicit_aliasing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (r *implicitAliasing) Match(n ast.Node, c *gosec.Context) (*issue.Issue, er
9090
}
9191

9292
// NewImplicitAliasing detects implicit memory aliasing of type: for blah := SomeCall() {... SomeOtherCall(&blah) ...}
93-
func NewImplicitAliasing(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
93+
func NewImplicitAliasing(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
9494
return &implicitAliasing{
9595
aliases: make(map[*ast.Object]struct{}),
9696
rightBrace: token.NoPos,

rules/integer_overflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (i *integerOverflowCheck) Match(node ast.Node, ctx *gosec.Context) (*issue.
7575
}
7676

7777
// NewIntegerOverflowCheck detects if there is potential Integer OverFlow
78-
func NewIntegerOverflowCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
78+
func NewIntegerOverflowCheck(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
7979
calls := gosec.NewCallList()
8080
calls.Add("strconv", "Atoi")
8181
return &integerOverflowCheck{

rules/pprof.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (p *pprofCheck) Match(n ast.Node, c *gosec.Context) (*issue.Issue, error) {
2929
}
3030

3131
// NewPprofCheck detects when the profiling endpoint is automatically exposed
32-
func NewPprofCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
32+
func NewPprofCheck(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
3333
return &pprofCheck{
3434
MetaData: issue.MetaData{
3535
ID: id,

rules/rand.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (w *weakRand) Match(n ast.Node, c *gosec.Context) (*issue.Issue, error) {
4242
}
4343

4444
// NewWeakRandCheck detects the use of random number generator that isn't cryptographically secure
45-
func NewWeakRandCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
45+
func NewWeakRandCheck(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
4646
return &weakRand{
4747
funcNames: []string{
4848
"New", "Read", "Float32", "Float64", "Int", "Int31",

rules/readfile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (r *readfile) Match(n ast.Node, c *gosec.Context) (*issue.Issue, error) {
126126
}
127127

128128
// NewReadFile detects cases where we read files
129-
func NewReadFile(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
129+
func NewReadFile(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
130130
rule := &readfile{
131131
pathJoin: gosec.NewCallList(),
132132
clean: gosec.NewCallList(),

rules/rsa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (w *weakKeyStrength) Match(n ast.Node, c *gosec.Context) (*issue.Issue, err
4242
}
4343

4444
// NewWeakKeyStrength builds a rule that detects RSA keys < 2048 bits
45-
func NewWeakKeyStrength(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
45+
func NewWeakKeyStrength(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
4646
calls := gosec.NewCallList()
4747
calls.Add("crypto/rsa", "GenerateKey")
4848
bits := 2048

rules/slowloris.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (r *slowloris) Match(n ast.Node, ctx *gosec.Context) (*issue.Issue, error)
5959
}
6060

6161
// NewSlowloris attempts to find the http.Server struct and check if the ReadHeaderTimeout is configured.
62-
func NewSlowloris(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
62+
func NewSlowloris(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
6363
return &slowloris{
6464
MetaData: issue.MetaData{
6565
ID: id,

rules/sql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func (s *sqlStrConcat) Match(n ast.Node, ctx *gosec.Context) (*issue.Issue, erro
161161
}
162162

163163
// NewSQLStrConcat looks for cases where we are building SQL strings via concatenation
164-
func NewSQLStrConcat(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
164+
func NewSQLStrConcat(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
165165
rule := &sqlStrConcat{
166166
sqlStatement: sqlStatement{
167167
patterns: []*regexp.Regexp{
@@ -324,7 +324,7 @@ func (s *sqlStrFormat) Match(n ast.Node, ctx *gosec.Context) (*issue.Issue, erro
324324
}
325325

326326
// NewSQLStrFormat looks for cases where we're building SQL query strings using format strings
327-
func NewSQLStrFormat(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
327+
func NewSQLStrFormat(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
328328
rule := &sqlStrFormat{
329329
CallList: gosec.NewCallList(),
330330
fmtCalls: gosec.NewCallList(),

rules/ssh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (r *sshHostKey) Match(n ast.Node, c *gosec.Context) (gi *issue.Issue, err e
2525
}
2626

2727
// NewSSHHostKey rule detects the use of insecure ssh HostKeyCallback.
28-
func NewSSHHostKey(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
28+
func NewSSHHostKey(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
2929
return &sshHostKey{
3030
pkg: "golang.org/x/crypto/ssh",
3131
calls: []string{"InsecureIgnoreHostKey"},

rules/ssrf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (r *ssrf) Match(n ast.Node, c *gosec.Context) (*issue.Issue, error) {
5252
}
5353

5454
// NewSSRFCheck detects cases where HTTP requests are sent
55-
func NewSSRFCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
55+
func NewSSRFCheck(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
5656
rule := &ssrf{
5757
CallList: gosec.NewCallList(),
5858
MetaData: issue.MetaData{

rules/subproc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (r *subprocess) isContext(n ast.Node, ctx *gosec.Context) bool {
110110
}
111111

112112
// NewSubproc detects cases where we are forking out to an external process
113-
func NewSubproc(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
113+
func NewSubproc(id string, _ gosec.Config) (gosec.Rule, []ast.Node) {
114114
rule := &subprocess{issue.MetaData{ID: id}, gosec.NewCallList()}
115115
rule.Add("os/exec", "Command")
116116
rule.Add("os/exec", "CommandContext")

0 commit comments

Comments
 (0)