trivy

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

Package trivy provides primitives for working with Trivy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetScoreFromCvss

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

func NewPlugin

func NewPlugin(idGenerator ext.IDGenerator, config Config) vulnerabilityreport.Plugin

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

This Plugin supports both starboard.Standalone and starboard.ClientServer client modes depending on the active mode returned by Config.GetTrivyMode.

The starboard.ClientServer mode is usually more performant, however it requires a Trivy server accessible at the configurable URL.

Types

type CVSS

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

type Config

type Config interface {
	GetTrivyImageRef() (string, error)
	GetTrivyMode() (starboard.TrivyMode, error)
	GetTrivyServerURL() (string, error)
	GetTrivyInsecureRegistries() map[string]bool
}

Config defines configuration params for the Trivy vulnerabilityreport.Plugin.

type Converter

type Converter interface {
	Convert(imageRef string, reader io.Reader) (v1alpha1.VulnerabilityScanResult, error)
}

Converter is the interface that wraps the Convert method.

Convert converts the vulnerabilities model used by Trivy to a generic model defined by the Custom Security Resource Specification.

func NewConverter

func NewConverter(config Config) Converter

type Layer

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

type ScanReport

type ScanReport 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