Skip to content
This repository was archived by the owner on Jul 23, 2023. It is now read-only.

Commit 81e9e1c

Browse files
committed
added necessary go.mod deps and added categories to vulnerabilities
1 parent edbda39 commit 81e9e1c

File tree

4 files changed

+44
-17
lines changed

4 files changed

+44
-17
lines changed

containerscan/elasticadapters.go

+3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ func (scanresult *ScanResultReport) ToFlatVulnerabilities() []*ElasticContainerV
2626
result.RelevantLinks = append(result.RelevantLinks, "https://nvd.nist.gov/vuln/detail/"+vul.Name)
2727
result.RelevantLinks = append(result.RelevantLinks, vul.Link)
2828
result.Vulnerability.Link = "https://nvd.nist.gov/vuln/detail/" + vul.Name
29+
30+
result.Categories.IsRCE = result.IsRCE()
2931
vuls = append(vuls, result)
3032
vul2indx[vul.Name] = len(vuls) - 1
33+
3134
}
3235
}
3336
// find first introduced

containerscan/rawdatastrucutres.go

+19-14
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,27 @@ type ScanResultLayer struct {
2727
Packages LinuxPkgs `json:"packageToFile"`
2828
}
2929

30+
type VulnerabilityCategory struct {
31+
IsRCE bool `json:"isRce"`
32+
}
33+
3034
// Vulnerability - a vul object
3135
type Vulnerability struct {
32-
Name string `json:"name"`
33-
ImgHash string `json:"imageHash"`
34-
ImgTag string `json:"imageTag"`
35-
RelatedPackageName string `json:"packageName"`
36-
PackageVersion string `json:"packageVersion"`
37-
Link string `json:"link"`
38-
Description string `json:"description"`
39-
Severity string `json:"severity"`
40-
Metadata interface{} `json:"metadata"`
41-
Fixes VulFixes `json:"fixedIn"`
42-
Relevancy string `json:"relevant"` // use the related enum
43-
UrgentCount int `json:"urgent"`
44-
NeglectedCount int `json:"neglected"`
45-
HealthStatus string `json:"healthStatus"`
36+
Name string `json:"name"`
37+
ImgHash string `json:"imageHash"`
38+
ImgTag string `json:"imageTag"`
39+
RelatedPackageName string `json:"packageName"`
40+
PackageVersion string `json:"packageVersion"`
41+
Link string `json:"link"`
42+
Description string `json:"description"`
43+
Severity string `json:"severity"`
44+
Metadata interface{} `json:"metadata"`
45+
Fixes VulFixes `json:"fixedIn"`
46+
Relevancy string `json:"relevant"` // use the related enum
47+
UrgentCount int `json:"urgent"`
48+
NeglectedCount int `json:"neglected"`
49+
HealthStatus string `json:"healthStatus"`
50+
Categories VulnerabilityCategory `json:"categories"`
4651
}
4752

4853
// FixedIn when and which pkg was fixed (which version as well)

go.mod

+20-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ module github.com/armosec/cluster-container-scanner-api
33
go 1.17
44

55
require (
6-
github.com/armosec/utils-k8s-go v0.0.1
6+
github.com/armosec/utils-k8s-go v0.0.2
77
github.com/francoispqt/gojay v1.2.13
88
)
9+
10+
require (
11+
github.com/armosec/utils-go v0.0.2 // indirect
12+
github.com/go-logr/logr v0.4.0 // indirect
13+
github.com/gogo/protobuf v1.3.2 // indirect
14+
github.com/golang/glog v1.0.0 // indirect
15+
github.com/google/go-cmp v0.5.5 // indirect
16+
github.com/google/gofuzz v1.1.0 // indirect
17+
github.com/json-iterator/go v1.1.11 // indirect
18+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
19+
github.com/modern-go/reflect2 v1.0.1 // indirect
20+
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
21+
golang.org/x/text v0.3.6 // indirect
22+
gopkg.in/inf.v0 v0.9.1 // indirect
23+
gopkg.in/yaml.v2 v2.4.0 // indirect
24+
k8s.io/apimachinery v0.22.2 // indirect
25+
k8s.io/klog/v2 v2.9.0 // indirect
26+
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
27+
)

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
5757
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
5858
github.com/armosec/utils-go v0.0.2 h1:NSzLcWNI0GoJ8SS+cvaiOPD/raBkS0ghZ1639cCXhfU=
5959
github.com/armosec/utils-go v0.0.2/go.mod h1:itWmRLzRdsnwjpEOomL0mBWGnVNNIxSjDAdyc+b0iUo=
60-
github.com/armosec/utils-k8s-go v0.0.1 h1:Ay3y7fW+4+FjVc0+obOWm8YsnEvM31vPAVoKTyTAFRk=
61-
github.com/armosec/utils-k8s-go v0.0.1/go.mod h1:qrU4pmY2iZsOb39Eltpm0sTTNM3E4pmeyWx4dgDUC2U=
60+
github.com/armosec/utils-k8s-go v0.0.2 h1:PvG/yzkl3TS5n0LIoY68Dc/yL79xykz5HIjZUpP3BmQ=
61+
github.com/armosec/utils-k8s-go v0.0.2/go.mod h1:qrU4pmY2iZsOb39Eltpm0sTTNM3E4pmeyWx4dgDUC2U=
6262
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
6363
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
6464
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=

0 commit comments

Comments
 (0)