2022-09-28 13:39:54 -05:00
|
|
|
package model
|
|
|
|
|
2023-04-18 13:07:47 -05:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
godigest "github.com/opencontainers/go-digest"
|
|
|
|
)
|
|
|
|
|
2022-09-28 13:39:54 -05:00
|
|
|
//nolint:tagliatelle // graphQL schema
|
|
|
|
type CVE struct {
|
|
|
|
ID string `json:"Id"`
|
|
|
|
Description string `json:"Description"`
|
|
|
|
Severity string `json:"Severity"`
|
|
|
|
Title string `json:"Title"`
|
|
|
|
PackageList []Package `json:"PackageList"`
|
|
|
|
}
|
|
|
|
|
|
|
|
//nolint:tagliatelle // graphQL schema
|
|
|
|
type Package struct {
|
|
|
|
Name string `json:"Name"`
|
|
|
|
InstalledVersion string `json:"InstalledVersion"`
|
|
|
|
FixedVersion string `json:"FixedVersion"`
|
|
|
|
}
|
2023-02-27 14:23:18 -05:00
|
|
|
|
|
|
|
const (
|
|
|
|
None = iota
|
|
|
|
Low
|
|
|
|
Medium
|
|
|
|
High
|
|
|
|
Critical
|
|
|
|
)
|
|
|
|
|
|
|
|
func SeverityValue(severity string) int {
|
|
|
|
sevMap := map[string]int{
|
|
|
|
"NONE": None,
|
|
|
|
"LOW": Low,
|
|
|
|
"MEDIUM": Medium,
|
|
|
|
"HIGH": High,
|
|
|
|
"CRITICAL": Critical,
|
|
|
|
}
|
|
|
|
|
|
|
|
return sevMap[severity]
|
|
|
|
}
|
2023-04-18 13:07:47 -05:00
|
|
|
|
|
|
|
type Descriptor struct {
|
|
|
|
Digest godigest.Digest
|
|
|
|
MediaType string
|
|
|
|
}
|
|
|
|
|
|
|
|
type TagInfo struct {
|
|
|
|
Name string
|
|
|
|
Descriptor Descriptor
|
|
|
|
Timestamp time.Time
|
|
|
|
}
|