0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-01-06 22:40:28 -05:00
zot/pkg/extensions/search/cve/model/models.go
LaurentiuNiculae 0a04b2a4ed
feat(cve): implemented trivy image scan for multiarch images (#1510)
Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
2023-07-06 11:36:26 +03:00

66 lines
1.1 KiB
Go

package model
import (
"time"
godigest "github.com/opencontainers/go-digest"
)
type ImageCVESummary struct {
Count int
MaxSeverity string
}
//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"`
}
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]
}
type Descriptor struct {
Digest godigest.Digest
MediaType string
}
type DescriptorInfo struct {
Descriptor
Timestamp time.Time
}
type TagInfo struct {
Tag string
Descriptor Descriptor
Manifests []DescriptorInfo
Timestamp time.Time
}