Documentation
¶
Overview ¶
Package data provides core data structures for vulnerability representation.
The package defines two main types:
- Vulnerability: normalized vulnerability information from any scanner
- ImageVulnerability: vulnerability with image context (digest, source, timestamp)
Vulnerabilities are uniquely identified by a SHA256 hash of exposure+package+version, enabling deduplication across multiple scanner sources.
Example usage:
vuln := &data.Vulnerability{
Exposure: "CVE-2021-44228",
Package: "log4j-core",
Version: "2.14.1",
Severity: "critical",
Score: 10.0,
IsFixed: false,
}
id := vuln.GetID() // SHA256 hash for deduplication
Index ¶
Constants ¶
View Source
const (
ShaConcatChar = "/"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImageVulnerability ¶
type ImageVulnerability struct {
*Vulnerability
// Image is the image name.
Image string `json:"image"`
// Digest is the image digest.
Digest string `json:"digest"`
// Source is the source of the vulnerability.
Source string `json:"source"`
// ProcessedAt is the time the vulnerability was processed.
ProcessedAt time.Time `json:"processed_at"`
}
ImageVulnerability represents a single vulnerability.
func DecorateVulnerabilities ¶
func DecorateVulnerabilities(list []*Vulnerability, image, digest, src string) []*ImageVulnerability
DecorateVulnerabilities decorates a list of vulnerabilities with image and digest.
func (*ImageVulnerability) Strings ¶
func (v *ImageVulnerability) Strings() []string
Strings returns the string representation of the vulnerability.
type Scan ¶
type Scan struct {
URI string `json:"uri"`
Digest string `json:"digest"`
ProcessedAt time.Time `json:"processed_at"`
RecordCount int `json:"record_count"`
Vulnerabilities []*Vulnerability `json:"vulnerabilities"`
}
Scan represents a vulnerability scan.
type Vulnerability ¶
type Vulnerability struct {
// Exposure is the vulnerability ID.
Exposure string `json:"exposure,omitempty"`
// Package is the package name.
Package string `json:"package,omitempty"`
// Version is the package version.
Version string `json:"version,omitempty"`
// Severity is the vulnerability severity.
Severity string `json:"severity,omitempty"`
// Score is the vulnerability score.
Score float32 `json:"score,omitempty"`
// Is Fixed indicates of the vulnerability has been fixed.
IsFixed bool `json:"fixed,omitempty"`
}
Vulnerability represents a single vulnerability.
func (*Vulnerability) GetID ¶ added in v0.5.0
func (v *Vulnerability) GetID() string
func (*Vulnerability) String ¶
func (v *Vulnerability) String() string
Click to show internal directories.
Click to hide internal directories.