mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +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"
|
SeverityLow = "low"
|
||||||
SeverityMedium = "medium"
|
SeverityMedium = "medium"
|
||||||
SeverityHigh = "high"
|
SeverityHigh = "high"
|
||||||
|
SeverityCritical = "critical"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProjectMetadata holds the metadata of a project.
|
// ProjectMetadata holds the metadata of a project.
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
package clair
|
package clair
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/vmware/harbor/src/common/dao"
|
"github.com/vmware/harbor/src/common/dao"
|
||||||
"github.com/vmware/harbor/src/common/models"
|
"github.com/vmware/harbor/src/common/models"
|
||||||
"github.com/vmware/harbor/src/common/utils/log"
|
"github.com/vmware/harbor/src/common/utils/log"
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ func ParseClairSev(clairSev string) models.Severity {
|
|||||||
return models.SevLow
|
return models.SevLow
|
||||||
case models.SeverityMedium:
|
case models.SeverityMedium:
|
||||||
return models.SevMedium
|
return models.SevMedium
|
||||||
case models.SeverityHigh:
|
case models.SeverityHigh, models.SeverityCritical:
|
||||||
return models.SevHigh
|
return models.SevHigh
|
||||||
default:
|
default:
|
||||||
return models.SevUnknown
|
return models.SevUnknown
|
||||||
|
@ -32,6 +32,7 @@ func TestParseServerity(t *testing.T) {
|
|||||||
"LOW": models.SevLow,
|
"LOW": models.SevLow,
|
||||||
"Medium": models.SevMedium,
|
"Medium": models.SevMedium,
|
||||||
"high": models.SevHigh,
|
"high": models.SevHigh,
|
||||||
|
"Critical": models.SevHigh,
|
||||||
}
|
}
|
||||||
for k, v := range in {
|
for k, v := range in {
|
||||||
assert.Equal(v, ParseClairSev(k))
|
assert.Equal(v, ParseClairSev(k))
|
||||||
|
Loading…
Reference in New Issue
Block a user