mirror of
https://github.com/project-zot/zot.git
synced 2024-12-30 22:34:13 -05:00
added more types of severity
Signed-off-by: laurentiuNiculae <themelopeus@gmail.com>
This commit is contained in:
parent
081ba0b2f2
commit
c9b32c73ae
2 changed files with 27 additions and 6 deletions
2
go.sum
2
go.sum
|
@ -2188,8 +2188,6 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
|
|||
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
github.com/openzipkin/zipkin-go v0.3.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ=
|
||||
github.com/openzipkin/zipkin-go v0.3.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ=
|
||||
github.com/oras-project/artifacts-spec v0.0.0-20210914235636-eecc5d95bcee/go.mod h1:Xch2aLzSwtkhbFFN6LUzTfLtukYvMMdXJ4oZ8O7BOdc=
|
||||
github.com/oras-project/artifacts-spec v0.0.0-20210914235636-eecc5d95bcee/go.mod h1:Xch2aLzSwtkhbFFN6LUzTfLtukYvMMdXJ4oZ8O7BOdc=
|
||||
github.com/oras-project/artifacts-spec v1.0.0-draft.1.1 h1:2YMUDyDH0glYA4gNG/zEg9HNVzgGX8kr/NBLR9AQkLQ=
|
||||
github.com/oras-project/artifacts-spec v1.0.0-draft.1.1/go.mod h1:Xch2aLzSwtkhbFFN6LUzTfLtukYvMMdXJ4oZ8O7BOdc=
|
||||
|
|
|
@ -367,12 +367,20 @@ func (service searchService) getCveByImage(ctx context.Context, config searchCon
|
|||
}
|
||||
|
||||
func groupCVEsBySeverity(cveList []cve) []cve {
|
||||
high := make([]cve, 0)
|
||||
med := make([]cve, 0)
|
||||
low := make([]cve, 0)
|
||||
var (
|
||||
unknown = make([]cve, 0)
|
||||
none = make([]cve, 0)
|
||||
high = make([]cve, 0)
|
||||
med = make([]cve, 0)
|
||||
low = make([]cve, 0)
|
||||
critical = make([]cve, 0)
|
||||
)
|
||||
|
||||
for _, cve := range cveList {
|
||||
switch cve.Severity {
|
||||
case "NONE":
|
||||
none = append(none, cve)
|
||||
|
||||
case "LOW":
|
||||
low = append(low, cve)
|
||||
|
||||
|
@ -381,10 +389,25 @@ func groupCVEsBySeverity(cveList []cve) []cve {
|
|||
|
||||
case "HIGH":
|
||||
high = append(high, cve)
|
||||
|
||||
case "CRITICAL":
|
||||
critical = append(critical, cve)
|
||||
|
||||
default:
|
||||
unknown = append(unknown, cve)
|
||||
}
|
||||
}
|
||||
vulnsCount := len(unknown) + len(none) + len(high) + len(med) + len(low) + len(critical)
|
||||
vulns := make([]cve, 0, vulnsCount)
|
||||
|
||||
return append(append(high, med...), low...)
|
||||
vulns = append(vulns, critical...)
|
||||
vulns = append(vulns, high...)
|
||||
vulns = append(vulns, med...)
|
||||
vulns = append(vulns, low...)
|
||||
vulns = append(vulns, none...)
|
||||
vulns = append(vulns, unknown...)
|
||||
|
||||
return vulns
|
||||
}
|
||||
|
||||
func isContextDone(ctx context.Context) bool {
|
||||
|
|
Loading…
Reference in a new issue