models

package
v0.0.0-...-b41f85f Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeverityCritical = "CRITICAL"
	SeverityMedium   = "MEDIUM"
	SeverityHigh     = "HIGH"
	SeverityLow      = "LOW"
)

Severity levels for vulnerabilities

View Source
const (
	PriorityCritical = "L0 - Critical"
	PriorityHigh     = "L1 - High"
	PriorityMedium   = "L2 - Medium"
	PriorityLow      = "L3 - Low"
)

Priority levels for Jira issues

Variables

SeverityToPriority maps vulnerability severity levels to Jira priority levels

Functions

This section is empty.

Types

type DirSource

type DirSource struct {
	// contains filtered or unexported fields
}

DirSource represents a source of images from a directory the directory should be a directory contains plugins, the plugins folder structure should be like definitions of alauda/artifacts dirPath: Path to the directory contains plugins

func (*DirSource) GetImages

func (d *DirSource) GetImages(ctx context.Context) ([]Image, error)

GetImages retrieves images from the artifacts directory up to now, only return all bundle and chart images

type Global

type Global struct {
	Registry Registry         `json:"registry" yaml:"registry,omitempty"`
	Images   map[string]Image `json:"images" yaml:"images,omitempty"`
}

Global represents the global section of a values file Registry: Registry configuration Images: Map of image configurations

type Image

type Image struct {
	Repository string `json:"repository" yaml:"repository"`
	Tag        string `json:"tag" yaml:"tag"`
	Owner      Owner  `json:"owner" yaml:"owner"`

	Registry string    `json:"-" yaml:"-"`
	Type     ImageType `json:"-" yaml:"-"`
}

Image represents a container image with its metadata Repository: The repository name of the image Tag: The tag of the image Owner: The ownership information of the image Registry: The registry where the image is stored (not serialized) Type: The type of the image (bundle, chart, image)

func ImageFromURL

func ImageFromURL(url string) (Image, error)

ImageFromURL creates an Image struct from a URL string url: The full URL of the image Returns the parsed Image and any error that occurred

func (*Image) ComponentName

func (i *Image) ComponentName() string

ComponentName extracts the component name from the repository Removes the registry prefix and "-bundle" suffix if present

func (*Image) URL

func (i *Image) URL() string

URL returns the full URL of the image including registry, repository and tag

type ImageSource

type ImageSource interface {
	GetImages(ctx context.Context) ([]Image, error)
}

ImageSource defines the interface for retrieving images

func NewDirSource

func NewDirSource(dirPath string, plugins []string) ImageSource

func NewValuesSource

func NewValuesSource(valuesPath, bundle string) ImageSource

NewValuesSource creates a new ValuesSource instance valuesPath: Path to the values file bundle: Optional bundle name to filter images

type ImageType

type ImageType string
const (
	ImageTypeBundle ImageType = "Bundle"
	ImageTypeChart  ImageType = "Chart"
	ImageTypeImage  ImageType = "Image"
)

type Owner

type Owner struct {
	Team     string `json:"team" yaml:"team"`
	JiraUser string `json:"jira_user" yaml:"jira_user"`
}

Owner represents the ownership information of an image Team: The team that owns the image JiraUser: The Jira user associated with the image

type Registry

type Registry struct {
	Address string `json:"address" yaml:"address"`
}

Registry represents registry configuration Address: The registry address

type ScanResult

type ScanResult struct {
	OS      []Vulnerability `json:"os"`
	Lang    []Vulnerability `json:"lang"`
	Secret  []interface{}   `json:"secret"`
	OSImage string          `json:"os_image"`
}

ScanResult represents the results of a vulnerability scan OS: Operating system vulnerabilities Lang: Language-specific vulnerabilities Secret: Secret scanning results OSImage: The base OS image used

func (*ScanResult) Priority

func (s *ScanResult) Priority() string

Priority returns the Jira priority corresponding to the highest severity in the scan result

func (*ScanResult) Severity

func (s *ScanResult) Severity() string

Severity returns the highest severity level found in the scan result

func (*ScanResult) TotalVulnerabilities

func (s *ScanResult) TotalVulnerabilities() int

TotalVulnerabilities returns the total number of vulnerabilities found

type ScanResults

type ScanResults map[Image]*ScanResult

ScanResults represents a map of images to their scan results

func (ScanResults) Priority

func (r ScanResults) Priority() string

Priority returns the highest Jira priority across all scan results

type SeverityList

type SeverityList []string

SeverityList represents a list of severity levels

func (SeverityList) Highest

func (s SeverityList) Highest() string

Highest returns the highest severity level from the list Returns an empty string if the list is empty

func (SeverityList) HighestPriority

func (s SeverityList) HighestPriority() string

HighestPriority returns the Jira priority corresponding to the highest severity

type Values

type Values struct {
	Global Global `json:"global" yaml:"global"`
}

Values represents the structure of a values file Global: Global configuration settings

type ValuesSource

type ValuesSource struct {
	// contains filtered or unexported fields
}

ValuesSource represents a source of images from a values file valuesPath: Path to the values file bundle: Optional bundle name to filter images

func (*ValuesSource) GetImages

func (v *ValuesSource) GetImages(ctx context.Context) ([]Image, error)

GetImages retrieves images from the values file Returns a list of images and any error that occurred

type Vulnerability

type Vulnerability struct {
	Target           string `json:"Target"`
	VulnerabilityID  string `json:"VulnerabilityID"`
	Severity         string `json:"Severity"`
	PkgName          string `json:"PkgName"`
	InstalledVersion string `json:"InstalledVersion"`
	FixedVersion     string `json:"FixedVersion"`
	Title            string `json:"Title"`
	Description      string `json:"Description"`
}

Vulnerability represents a single vulnerability finding Target: The target of the vulnerability VulnerabilityID: The unique identifier of the vulnerability Severity: The severity level of the vulnerability PkgName: The name of the affected package InstalledVersion: The currently installed version FixedVersion: The version that fixes the vulnerability Title: The title of the vulnerability Description: The description of the vulnerability

Jump to

Keyboard shortcuts

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