Skip to content

Commit a279af8

Browse files
committed
fix: don't show overview for devices without findings
1 parent 4d9f406 commit a279af8

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

pkg/overview/security/builder.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,36 @@ func BuildSecurityOverviewMessage(logger *logrus.Logger, config config.Config, f
1818
}
1919

2020
var allFalcon []falcon.FalconResult
21-
for _, f := range falconResults { allFalcon = append(allFalcon, f) }
21+
for _, f := range falconResults {
22+
allFalcon = append(allFalcon, f)
23+
}
2224

2325
var allWS1 []ws1.WS1Result
24-
for _, w := range ws1Results { allWS1 = append(allWS1, w) }
26+
for _, w := range ws1Results {
27+
hasIssues := false
28+
for _, device := range w.Devices {
29+
if len(device.Findings) > 0 {
30+
hasIssues = true
31+
break
32+
}
33+
}
34+
35+
if hasIssues {
36+
allWS1 = append(allWS1, w)
37+
}
38+
}
2539

2640
logrus.Debugf("findings: falcon: %d ws1: %d", len(allFalcon), len(allWS1))
2741

2842
variables := struct {
2943
Falcon []falcon.FalconResult
30-
WS1 []ws1.WS1Result
31-
Date time.Time
44+
WS1 []ws1.WS1Result
45+
Date time.Time
3246
Errors []error
3347
}{
34-
Date: time.Now(),
48+
Date: time.Now(),
3549
Falcon: allFalcon,
36-
WS1: allWS1,
50+
WS1: allWS1,
3751
Errors: reportedErrors,
3852
}
3953

0 commit comments

Comments
 (0)