trivy

package
v0.15.20 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Overview

Package trivy provides primitives for working with Trivy.

Index

Constants

View Source
const (
	FsSharedVolumeName          = "starboard"
	SharedVolumeLocationOfTrivy = "/var/starboard/trivy"
)
View Source
const (
	AWSECR_Image_Regex = "^\\d+\\.dkr\\.ecr\\.(\\w+-\\w+-\\d+)\\.amazonaws\\.com\\/"
)
View Source
const (
	// Plugin the name of this plugin.
	Plugin = "Trivy"
)

Variables

This section is empty.

Functions

func CheckAwsEcrPrivateRegistry added in v0.15.5

func CheckAwsEcrPrivateRegistry(ImageUrl string) string

func GetMirroredImage added in v0.12.0

func GetMirroredImage(image string, mirrors map[string]string) (string, error)

func GetScoreFromCVSS added in v0.11.0

func GetScoreFromCVSS(CVSSs map[string]*CVSS) *float64

func NewPlugin

func NewPlugin(clock ext.Clock, idGenerator ext.IDGenerator, objectResolver *kube.ObjectResolver) vulnerabilityreport.Plugin

NewPlugin constructs a new vulnerabilityreport.Plugin, which is using an upstream Trivy container image to scan Kubernetes workloads.

The plugin supports Image and Filesystem commands. The Filesystem command may be used to scan workload images cached on cluster nodes by scheduling scan jobs on a particular node.

The Image command supports both Standalone and ClientServer modes depending on the settings returned by Config.GetMode. The ClientServer mode is usually more performant, however it requires a Trivy server accessible at the configurable Config.GetServerURL.

Types

type CVSS

type CVSS struct {
	V3Score *float64 `json:"V3Score,omitempty"`
}

type Command added in v0.14.1

type Command string

Command to scan image or filesystem.

const (
	Filesystem Command = "filesystem"
	Image      Command = "image"
)

type Config

type Config struct {
	starboard.PluginConfig
}

Config defines configuration params for this plugin.

func (Config) GetCommand added in v0.14.1

func (c Config) GetCommand() (Command, error)

func (Config) GetDBRepository added in v0.15.4

func (c Config) GetDBRepository() (string, error)

func (Config) GetImageRef added in v0.11.0

func (c Config) GetImageRef() (string, error)

GetImageRef returns upstream Trivy container image reference.

func (Config) GetInsecureRegistries added in v0.11.0

func (c Config) GetInsecureRegistries() map[string]bool

func (Config) GetMirrors added in v0.12.0

func (c Config) GetMirrors() map[string]string

func (Config) GetMode added in v0.11.0

func (c Config) GetMode() (Mode, error)

func (Config) GetNonSSLRegistries added in v0.15.0

func (c Config) GetNonSSLRegistries() map[string]bool

func (Config) GetResourceRequirements added in v0.11.0

func (c Config) GetResourceRequirements() (corev1.ResourceRequirements, error)

GetResourceRequirements creates ResourceRequirements from the Config.

func (Config) GetServerInsecure added in v0.15.0

func (c Config) GetServerInsecure() bool

func (Config) GetServerURL added in v0.11.0

func (c Config) GetServerURL() (string, error)

func (Config) IgnoreFileExists added in v0.11.0

func (c Config) IgnoreFileExists() bool

func (Config) IgnoreUnfixed added in v0.14.1

func (c Config) IgnoreUnfixed() bool

type Layer

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

type Mode added in v0.11.0

type Mode string

Mode in which Trivy client operates.

const (
	Standalone   Mode = "Standalone"
	ClientServer Mode = "ClientServer"
)

type ScanReport

type ScanReport struct {
	Results []ScanResult `json:"Results"`
}

type ScanResult added in v0.13.0

type ScanResult struct {
	Target          string          `json:"Target"`
	Vulnerabilities []Vulnerability `json:"Vulnerabilities"`
}

type Vulnerability

type Vulnerability struct {
	VulnerabilityID  string            `json:"VulnerabilityID"`
	PkgName          string            `json:"PkgName"`
	InstalledVersion string            `json:"InstalledVersion"`
	FixedVersion     string            `json:"FixedVersion"`
	Title            string            `json:"Title"`
	Description      string            `json:"Description"`
	Severity         v1alpha1.Severity `json:"Severity"`
	Layer            Layer             `json:"Layer"`
	PrimaryURL       string            `json:"PrimaryURL"`
	References       []string          `json:"References"`
	Cvss             map[string]*CVSS  `json:"CVSS"`
}

Jump to

Keyboard shortcuts

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