Skip to content

Commit b4c7469

Browse files
Dimitar Banchevccojocar
authored andcommitted
Formatting problems(CI was not passing)
1 parent 7f8f654 commit b4c7469

File tree

3 files changed

+26
-32
lines changed

3 files changed

+26
-32
lines changed

analyzer_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,6 @@ var _ = Describe("Analyzer", func() {
15211521
Expect(controlIssues[0].Suppressions[0].Justification).To(Equal("Globally suppressed."))
15221522
})
15231523

1524-
15251524
It("should not report an error if the analyzer is excluded", func() {
15261525
sample := testutils.SampleCodeG407[0]
15271526
source := sample.Code[0]

analyzers/hardcodedNonce.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ func runHardCodedNonce(pass *analysis.Pass) (interface{}, error) {
5757
"crypto/cipher.NewOFB": {2, 1},
5858
}
5959
var issues []*issue.Issue
60-
var ssaPkgFunctions = ssaResult.SSA.SrcFuncs
61-
var savedArgsFromFunctions = *iterateAndGetArgsFromTrackedFunctions(ssaPkgFunctions, &calls)
60+
ssaPkgFunctions := ssaResult.SSA.SrcFuncs
61+
savedArgsFromFunctions := *iterateAndGetArgsFromTrackedFunctions(ssaPkgFunctions, &calls)
6262

6363
for _, savedArg := range savedArgsFromFunctions {
6464
tmp, err := raiseIssue(savedArg, &calls, ssaPkgFunctions, pass, "")
@@ -148,14 +148,12 @@ func raiseIssue(val *ssa.Value, funcsToTrack *map[string][]int, ssaFuncs []*ssa.
148148

149149
// Iterate through all places that use the `variable` argument and check if it's used in one of the tracked functions
150150
func iterateThroughReferrers(variable *ssa.Value, funcsToTrack *map[string][]int, analyzerID string, issueDescription string, fileSet *token.FileSet, issueSeverity issue.Score, issueConfidence issue.Score) ([]*issue.Issue, error) {
151-
152151
if funcsToTrack == nil || variable == nil || analyzerID == "" || issueDescription == "" || fileSet == nil {
153152
return nil, errors.New("received a nil object")
154153
}
155154
var gosecIssues []*issue.Issue = nil
156155
// Go trough all functions that use the given arg variable
157156
for _, referrer := range *(*variable).Referrers() {
158-
159157
// Iterate trough the functions we are interested
160158
for trackedFunc := range *funcsToTrack {
161159

testutils/g407_samples.go

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ package testutils
22

33
import "github.com/securego/gosec/v2"
44

5-
var (
6-
// SampleCodeG407 - Use of hardcoded nonce/IV
7-
SampleCodeG407 = []CodeSample{
8-
9-
{[]string{`package main
5+
// SampleCodeG407 - Use of hardcoded nonce/IV
6+
var SampleCodeG407 = []CodeSample{
7+
{[]string{`package main
108
119
import (
1210
"crypto/aes"
@@ -25,7 +23,7 @@ func main() {
2523
}
2624
`}, 1, gosec.NewConfig()},
2725

28-
{[]string{`package main
26+
{[]string{`package main
2927
3028
import (
3129
"crypto/aes"
@@ -45,7 +43,7 @@ func main() {
4543
4644
`}, 0, gosec.NewConfig()},
4745

48-
{[]string{`package main
46+
{[]string{`package main
4947
5048
import (
5149
"crypto/aes"
@@ -79,7 +77,7 @@ func main() {
7977
}
8078
`}, 0, gosec.NewConfig()},
8179

82-
{[]string{`package main
80+
{[]string{`package main
8381
8482
import (
8583
"crypto/aes"
@@ -97,7 +95,7 @@ func main() {
9795
9896
}`}, 1, gosec.NewConfig()},
9997

100-
{[]string{`package main
98+
{[]string{`package main
10199
102100
import (
103101
"crypto/aes"
@@ -115,7 +113,7 @@ func main() {
115113
116114
}`}, 1, gosec.NewConfig()},
117115

118-
{[]string{`package main
116+
{[]string{`package main
119117
120118
import (
121119
"crypto/aes"
@@ -134,7 +132,7 @@ func main() {
134132
}
135133
`}, 1, gosec.NewConfig()},
136134

137-
{[]string{`package main
135+
{[]string{`package main
138136
139137
import (
140138
"crypto/aes"
@@ -154,7 +152,7 @@ func main() {
154152
}
155153
`}, 2, gosec.NewConfig()},
156154

157-
{[]string{`package main
155+
{[]string{`package main
158156
159157
import (
160158
"crypto/aes"
@@ -174,7 +172,7 @@ func main() {
174172
}
175173
`}, 2, gosec.NewConfig()},
176174

177-
{[]string{`package main
175+
{[]string{`package main
178176
179177
import (
180178
"crypto/aes"
@@ -195,7 +193,7 @@ func main() {
195193
}
196194
`}, 2, gosec.NewConfig()},
197195

198-
{[]string{`package main
196+
{[]string{`package main
199197
200198
import (
201199
"crypto/aes"
@@ -229,7 +227,7 @@ func main() {
229227
}
230228
`}, 2, gosec.NewConfig()},
231229

232-
{[]string{`package main
230+
{[]string{`package main
233231
234232
import (
235233
"crypto/aes"
@@ -262,7 +260,7 @@ func main() {
262260
}
263261
`}, 2, gosec.NewConfig()},
264262

265-
{[]string{`package main
263+
{[]string{`package main
266264
267265
import (
268266
"crypto/aes"
@@ -282,7 +280,7 @@ func main() {
282280
}
283281
`}, 2, gosec.NewConfig()},
284282

285-
{[]string{`package main
283+
{[]string{`package main
286284
287285
import (
288286
"crypto/aes"
@@ -302,7 +300,7 @@ func main() {
302300
}
303301
`}, 2, gosec.NewConfig()},
304302

305-
{[]string{`package main
303+
{[]string{`package main
306304
307305
import (
308306
"crypto/aes"
@@ -323,7 +321,7 @@ func main() {
323321
324322
}`}, 2, gosec.NewConfig()},
325323

326-
{[]string{`package main
324+
{[]string{`package main
327325
328326
import (
329327
"crypto/aes"
@@ -344,7 +342,7 @@ func main() {
344342
345343
}`}, 2, gosec.NewConfig()},
346344

347-
{[]string{`package main
345+
{[]string{`package main
348346
349347
import (
350348
"crypto/aes"
@@ -367,7 +365,7 @@ func main() {
367365
368366
}`}, 2, gosec.NewConfig()},
369367

370-
{[]string{`package main
368+
{[]string{`package main
371369
372370
import (
373371
"crypto/aes"
@@ -391,7 +389,7 @@ func main() {
391389
}
392390
`}, 2, gosec.NewConfig()},
393391

394-
{[]string{`package main
392+
{[]string{`package main
395393
396394
import (
397395
"crypto/aes"
@@ -408,7 +406,7 @@ func main() {
408406
}
409407
`}, 1, gosec.NewConfig()},
410408

411-
{[]string{`package main
409+
{[]string{`package main
412410
413411
import (
414412
"crypto/aes"
@@ -427,7 +425,7 @@ func main() {
427425
}
428426
`}, 1, gosec.NewConfig()},
429427

430-
{[]string{`package main
428+
{[]string{`package main
431429
432430
import (
433431
"crypto/aes"
@@ -453,7 +451,7 @@ func main() {
453451
}
454452
`}, 0, gosec.NewConfig()},
455453

456-
{[]string{`package main
454+
{[]string{`package main
457455
458456
import (
459457
"crypto/aes"
@@ -472,5 +470,4 @@ func main() {
472470
473471
}
474472
`}, 1, gosec.NewConfig()},
475-
}
476-
)
473+
}

0 commit comments

Comments
 (0)