mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
Fix mis-interpretation of severity in Clair
Currently "Critical" vulnerablity is treated as "Unknown" in Harbor. This commit provides a quickfix that it will be interpret as "High". In future, we should consider introduce "Critical" and enable UI to handle it to be more consistent with CVSS spec.
This commit is contained in:
parent
5089b26cf8
commit
93c448d91b
@ -29,6 +29,7 @@ const (
|
||||
SeverityLow = "low"
|
||||
SeverityMedium = "medium"
|
||||
SeverityHigh = "high"
|
||||
SeverityCritical = "critical"
|
||||
)
|
||||
|
||||
// ProjectMetadata holds the metadata of a project.
|
||||
|
@ -15,10 +15,10 @@
|
||||
package clair
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/vmware/harbor/src/common/dao"
|
||||
"github.com/vmware/harbor/src/common/models"
|
||||
"github.com/vmware/harbor/src/common/utils/log"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -34,7 +34,7 @@ func ParseClairSev(clairSev string) models.Severity {
|
||||
return models.SevLow
|
||||
case models.SeverityMedium:
|
||||
return models.SevMedium
|
||||
case models.SeverityHigh:
|
||||
case models.SeverityHigh, models.SeverityCritical:
|
||||
return models.SevHigh
|
||||
default:
|
||||
return models.SevUnknown
|
||||
|
@ -32,6 +32,7 @@ func TestParseServerity(t *testing.T) {
|
||||
"LOW": models.SevLow,
|
||||
"Medium": models.SevMedium,
|
||||
"high": models.SevHigh,
|
||||
"Critical": models.SevHigh,
|
||||
}
|
||||
for k, v := range in {
|
||||
assert.Equal(v, ParseClairSev(k))
|
||||
|
Loading…
Reference in New Issue
Block a user