vulnerability

package
v1.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CVSSInfo

type CVSSInfo struct {
	// V2Score is the CVSS v2 score
	//
	// Required: false
	V2Score float64 `json:"v2Score,omitempty"`

	// V3Score is the CVSS v3 score
	//
	// Required: false
	V3Score float64 `json:"v3Score,omitempty"`

	// V2Vector is the CVSS v2 vector string
	//
	// Required: false
	V2Vector string `json:"v2Vector,omitempty"`

	// V3Vector is the CVSS v3 vector string
	//
	// Required: false
	V3Vector string `json:"v3Vector,omitempty"`
}

CVSSInfo contains CVSS score information

type EnvironmentVulnerabilitySummary

type EnvironmentVulnerabilitySummary struct {
	// TotalImages is the total number of images in the environment
	//
	// Required: true
	TotalImages int `json:"totalImages"`

	// ScannedImages is the number of images with completed scans
	//
	// Required: true
	ScannedImages int `json:"scannedImages"`

	// Summary contains the aggregated severity summary
	//
	// Required: false
	Summary *SeveritySummary `json:"summary,omitempty"`
}

EnvironmentVulnerabilitySummary contains aggregated vulnerability info for an environment

type IgnorePayload

type IgnorePayload struct {
	// ImageID is the Docker image ID
	//
	// Required: true
	ImageID string `json:"imageId" example:"sha256:abc123"`

	// VulnerabilityID is the CVE or vulnerability identifier
	//
	// Required: true
	VulnerabilityID string `json:"vulnerabilityId" example:"CVE-2023-1234"`

	// PkgName is the package name containing the vulnerability
	//
	// Required: true
	PkgName string `json:"pkgName" example:"openssl"`

	// InstalledVersion is the version of the package with the vulnerability
	//
	// Required: false
	InstalledVersion string `json:"installedVersion,omitempty" example:"1.1.1l"`

	// Reason is an optional reason for ignoring this vulnerability
	//
	// Required: false
	Reason *string `json:"reason,omitempty" example:"False positive - not exploitable"`

	// CreatedBy is the user ID who created this ignore record (set by server from auth; do not send from client)
	//
	// Required: false
	CreatedBy string `json:"createdBy,omitempty" example:"user-123"`
}

IgnorePayload represents the request to ignore a vulnerability

type IgnoredVulnerability

type IgnoredVulnerability struct {
	// ID is the unique identifier for this ignore record
	ID string `json:"id"`

	// EnvironmentID is the environment where this ignore applies
	EnvironmentID string `json:"environmentId"`

	// ImageID is the Docker image ID
	ImageID string `json:"imageId"`

	// VulnerabilityID is the CVE or vulnerability identifier
	VulnerabilityID string `json:"vulnerabilityId"`

	// PkgName is the package name containing the vulnerability
	PkgName string `json:"pkgName"`

	// InstalledVersion is the version of the package with the vulnerability
	InstalledVersion string `json:"installedVersion"`

	// Reason is an optional reason for ignoring this vulnerability
	Reason *string `json:"reason,omitempty"`

	// CreatedBy is the user ID who created this ignore record
	CreatedBy string `json:"createdBy"`

	// CreatedAt is when this ignore record was created
	CreatedAt time.Time `json:"createdAt"`
}

IgnoredVulnerability represents an ignored vulnerability record

type ScanResult

type ScanResult struct {
	// ImageID is the Docker image ID that was scanned
	//
	// Required: true
	ImageID string `json:"imageId"`

	// ImageName is the image name with tag (e.g., nginx:latest)
	//
	// Required: true
	ImageName string `json:"imageName"`

	// ScanTime is the timestamp when the scan was performed
	//
	// Required: true
	ScanTime time.Time `json:"scanTime"`

	// Status is the status of the scan (scanning, completed, failed)
	//
	// Required: true
	Status ScanStatus `json:"status"`

	// Summary contains the severity summary of vulnerabilities found
	//
	// Required: false
	Summary *SeveritySummary `json:"summary,omitempty"`

	// Vulnerabilities is the list of vulnerabilities found
	//
	// Required: false
	Vulnerabilities []Vulnerability `json:"vulnerabilities,omitempty"`

	// Error contains the error message if the scan failed
	//
	// Required: false
	Error string `json:"error,omitempty"`

	// Duration is the duration of the scan in milliseconds
	//
	// Required: false
	Duration int64 `json:"duration,omitempty"`

	// ScannerVersion is the version of the scanner used
	//
	// Required: false
	ScannerVersion string `json:"scannerVersion,omitempty"`
}

ScanResult represents the result of a vulnerability scan

func ConvertTrivyReportToScanResult

func ConvertTrivyReportToScanResult(report *TrivyReport, imageID string, scanTime time.Time, duration int64) *ScanResult

ConvertTrivyReportToScanResult converts a TrivyReport to a ScanResult

type ScanStatus

type ScanStatus string

ScanStatus represents the status of a vulnerability scan

const (
	ScanStatusPending   ScanStatus = "pending"
	ScanStatusScanning  ScanStatus = "scanning"
	ScanStatusCompleted ScanStatus = "completed"
	ScanStatusFailed    ScanStatus = "failed"
)

type ScanSummariesRequest

type ScanSummariesRequest struct {
	// ImageIDs is the list of Docker image IDs to fetch summaries for.
	//
	// Required: true
	ImageIDs []string `json:"imageIds"`
}

ScanSummariesRequest is a batch request for scan summaries by image ID.

type ScanSummariesResponse

type ScanSummariesResponse struct {
	// Summaries maps image ID to scan summary.
	//
	// Required: true
	Summaries map[string]*ScanSummary `json:"summaries"`
}

ScanSummariesResponse wraps summaries keyed by image ID.

type ScanSummary

type ScanSummary struct {
	// ImageID is the Docker image ID that was scanned
	//
	// Required: true
	ImageID string `json:"imageId"`

	// ScanTime is the timestamp when the scan was performed
	//
	// Required: true
	ScanTime time.Time `json:"scanTime"`

	// Status is the status of the scan
	//
	// Required: true
	Status ScanStatus `json:"status"`

	// Summary contains the severity summary of vulnerabilities found
	//
	// Required: false
	Summary *SeveritySummary `json:"summary,omitempty"`

	// Error contains the error message if the scan failed
	//
	// Required: false
	Error string `json:"error,omitempty"`
}

ScanSummary contains a summary of a vulnerability scan for display in lists

type Severity

type Severity string

Severity represents the severity level of a vulnerability

const (
	SeverityUnknown  Severity = "UNKNOWN"
	SeverityLow      Severity = "LOW"
	SeverityMedium   Severity = "MEDIUM"
	SeverityHigh     Severity = "HIGH"
	SeverityCritical Severity = "CRITICAL"
)

type SeveritySummary

type SeveritySummary struct {
	// Critical is the count of critical vulnerabilities
	//
	// Required: true
	Critical int `json:"critical"`

	// High is the count of high severity vulnerabilities
	//
	// Required: true
	High int `json:"high"`

	// Medium is the count of medium severity vulnerabilities
	//
	// Required: true
	Medium int `json:"medium"`

	// Low is the count of low severity vulnerabilities
	//
	// Required: true
	Low int `json:"low"`

	// Unknown is the count of unknown severity vulnerabilities
	//
	// Required: true
	Unknown int `json:"unknown"`

	// Total is the total count of vulnerabilities
	//
	// Required: true
	Total int `json:"total"`
}

SeveritySummary contains counts of vulnerabilities by severity

type TrivyCVSS

type TrivyCVSS struct {
	V2Vector string  `json:"V2Vector"`
	V3Vector string  `json:"V3Vector"`
	V2Score  float64 `json:"V2Score"`
	V3Score  float64 `json:"V3Score"`
}

TrivyCVSS contains CVSS score information from Trivy

type TrivyDataSource

type TrivyDataSource struct {
	ID   string `json:"ID"`
	Name string `json:"Name"`
	URL  string `json:"URL"`
}

TrivyDataSource contains information about the data source

type TrivyLayer

type TrivyLayer struct {
	Digest string `json:"Digest"`
	DiffID string `json:"DiffID"`
}

TrivyLayer contains information about the layer where the vulnerability was found

type TrivyMetadata

type TrivyMetadata struct {
	OS          *TrivyOS `json:"OS,omitempty"`
	ImageID     string   `json:"ImageID"`
	DiffIDs     []string `json:"DiffIDs"`
	RepoTags    []string `json:"RepoTags"`
	RepoDigests []string `json:"RepoDigests"`
}

TrivyMetadata contains metadata about the scanned artifact

type TrivyOS

type TrivyOS struct {
	Family string `json:"Family"`
	Name   string `json:"Name"`
}

TrivyOS contains OS information

type TrivyReport

type TrivyReport struct {
	SchemaVersion int            `json:"SchemaVersion"`
	ArtifactName  string         `json:"ArtifactName"`
	ArtifactType  string         `json:"ArtifactType"`
	Metadata      TrivyMetadata  `json:"Metadata"`
	Results       []TrivyResults `json:"Results"`
}

TrivyReport represents the JSON output structure from Trivy scanner

type TrivyResults

type TrivyResults struct {
	Target          string               `json:"Target"`
	Class           string               `json:"Class"`
	Type            string               `json:"Type"`
	Vulnerabilities []TrivyVulnerability `json:"Vulnerabilities"`
}

TrivyResults contains the results for a specific target

type TrivyVulnerability

type TrivyVulnerability struct {
	VulnerabilityID  string               `json:"VulnerabilityID"`
	PkgID            string               `json:"PkgID"`
	PkgName          string               `json:"PkgName"`
	InstalledVersion string               `json:"InstalledVersion"`
	FixedVersion     string               `json:"FixedVersion"`
	Status           string               `json:"Status"`
	Layer            *TrivyLayer          `json:"Layer,omitempty"`
	SeveritySource   string               `json:"SeveritySource"`
	PrimaryURL       string               `json:"PrimaryURL"`
	DataSource       *TrivyDataSource     `json:"DataSource,omitempty"`
	Title            string               `json:"Title"`
	Description      string               `json:"Description"`
	Severity         string               `json:"Severity"`
	CweIDs           []string             `json:"CweIDs"`
	CVSS             map[string]TrivyCVSS `json:"CVSS"`
	References       []string             `json:"References"`
	PublishedDate    string               `json:"PublishedDate"`
	LastModifiedDate string               `json:"LastModifiedDate"`
}

TrivyVulnerability represents a vulnerability in Trivy output

type Vulnerability

type Vulnerability struct {
	// VulnerabilityID is the unique identifier for the vulnerability (e.g., CVE-2021-1234)
	//
	// Required: true
	VulnerabilityID string `json:"vulnerabilityId"`

	// PkgName is the name of the package containing the vulnerability
	//
	// Required: true
	PkgName string `json:"pkgName"`

	// InstalledVersion is the installed version of the vulnerable package
	//
	// Required: true
	InstalledVersion string `json:"installedVersion"`

	// FixedVersion is the version where the vulnerability is fixed (empty if not fixed)
	//
	// Required: false
	FixedVersion string `json:"fixedVersion,omitempty"`

	// Severity is the severity level of the vulnerability
	//
	// Required: true
	Severity Severity `json:"severity"`

	// Title is the title of the vulnerability
	//
	// Required: false
	Title string `json:"title,omitempty"`

	// Description is the description of the vulnerability
	//
	// Required: false
	Description string `json:"description,omitempty"`

	// References is a list of references related to the vulnerability
	//
	// Required: false
	References []string `json:"references,omitempty"`

	// CVSS contains the CVSS score information
	//
	// Required: false
	CVSS *CVSSInfo `json:"cvss,omitempty"`

	// PublishedDate is the date when the vulnerability was published
	//
	// Required: false
	PublishedDate *time.Time `json:"publishedDate,omitempty"`

	// LastModifiedDate is the date when the vulnerability was last modified
	//
	// Required: false
	LastModifiedDate *time.Time `json:"lastModifiedDate,omitempty"`
}

Vulnerability represents a single vulnerability found in an image

type VulnerabilityWithImage

type VulnerabilityWithImage struct {
	Vulnerability

	// ImageID is the Docker image ID that contains the vulnerability
	//
	// Required: true
	ImageID string `json:"imageId"`

	// ImageName is the image name with tag (e.g., nginx:latest)
	//
	// Required: true
	ImageName string `json:"imageName"`
}

VulnerabilityWithImage represents a vulnerability with its source image context

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL