image

package
v0.0.0-...-6bd98f9 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Overview

This script minimizes the size of a trivy report by factoring out vulnerability details, so that details for common vulnerabilities are not duplicated for each instance of that vulnerability.

Index

Constants

View Source
const DockerIOprefix = "docker.io/"
View Source
const MaxNewestVersionsToScan = 1
View Source
const TempDir = "/output/tmp"

TempDir is the directory to use for temporary storage.

Variables

This section is empty.

Functions

func ConvertTrivyResultsToImageReport

func ConvertTrivyResultsToImageReport(images []models.Image, reportResultByRef map[string]*models.TrivyResults, ignoreErrors bool) []models.ImageReport

ConvertTrivyResultsToImageReport maps results from Trivy with metadata about the image scanned.

func FetchLastReport

func FetchLastReport(ctx context.Context, host, org, cluster, token string) (*models.MinimizedReport, error)

FetchLastReport returns the last report for Trivy from Fairwinds Insights

func GetImages

func GetImages(ctx context.Context, namespaceBlocklist, namespaceAllowlist []string) ([]models.Image, error)

GetImages returns the images in the current cluster.

func GetImagesToReScan

func GetImagesToReScan(images []models.Image, lastReport models.MinimizedReport, imagesToScan []models.Image, maxScans int) []models.Image

func GetMatchingImages

func GetMatchingImages(baseImages []models.ImageDetailsWithRefs, toMatch []models.Image, isRecommendation bool) []models.ImageDetailsWithRefs

func GetNewestVersions

func GetNewestVersions(ctx context.Context, repo, tag string) ([]string, error)

GetNewestVersions returns newest versions and newest version within same major version

func GetNewestVersionsToScan

func GetNewestVersionsToScan(ctx context.Context, allReports []models.ImageReport, imagesToScan []models.Image) []models.Image

func GetRecommendationKey

func GetRecommendationKey(repoName, specific string) string

func GetSpecificToken

func GetSpecificToken(tag string) string

func GetUnmatchingImages

func GetUnmatchingImages(baseImages []models.ImageDetailsWithRefs, toMatch []models.Image, isRecommendation bool) []models.ImageDetailsWithRefs

func GetUnscannedImagesToScan

func GetUnscannedImagesToScan(imagesInCluster []models.Image, lastReportImages []models.ImageDetailsWithRefs, maxScans int) []models.Image

func Minimize

func Minimize(images []models.ImageReport, lastReport models.MinimizedReport) models.MinimizedReport

Minimize compresses the format of the Trivy report to de-duplicate information about vulnerabilities.

func ScanImage

func ScanImage(extraFlags, pullRef string) (*models.TrivyResults, error)

ScanImage will scan a single image with Trivy and return the results.

func ScanImages

func ScanImages(images []models.Image, maxConcurrentScans int, extraFlags string, ignoreErrors bool) []models.ImageReport

ScanImages will download the set of images given and scan them with Trivy.

func Sort

func Sort(versions []*semver.Version)

Sort sorts the given slice of Version

func UpdateOwnersReferenceOnMatchingImages

func UpdateOwnersReferenceOnMatchingImages(baseImages []models.ImageDetailsWithRefs, clusterImages []models.Image) []models.ImageDetailsWithRefs

Types

type NewestVersions

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

type Versions

type Versions []*semver.Version

func (Versions) Len

func (s Versions) Len() int

func (Versions) Less

func (s Versions) Less(i, j int) bool

func (Versions) Swap

func (s Versions) Swap(i, j int)

func (Versions) ToStringSlice

func (s Versions) ToStringSlice() []string

Jump to

Keyboard shortcuts

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