mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-01 21:47:57 +01:00
bba4b2a6a4
Interceptor will filter the vulnerability in whitelist while calculating the serverity of an image and determine whether or not to block client form pulling it. It will use the system level whitelist in this commit, another commit will switch to project level whitelist based on setting in a project. Signed-off-by: Daniel Jiang <jiangd@vmware.com>
27 lines
537 B
Go
27 lines
537 B
Go
package models
|
|
|
|
// Severity represents the severity of a image/component in terms of vulnerability.
|
|
type Severity int64
|
|
|
|
// Sevxxx is the list of severity of image after scanning.
|
|
const (
|
|
_ Severity = iota
|
|
SevNone
|
|
SevUnknown
|
|
SevLow
|
|
SevMedium
|
|
SevHigh
|
|
)
|
|
|
|
// String is the output function for severity variable
|
|
func (sev Severity) String() string {
|
|
name := []string{"negligible", "unknown", "low", "medium", "high"}
|
|
i := int64(sev)
|
|
switch {
|
|
case i >= 1 && i <= int64(SevHigh):
|
|
return name[i-1]
|
|
default:
|
|
return "unknown"
|
|
}
|
|
}
|