image

package
v0.0.0-...-dc73fe9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 25 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, trivyErrors map[string]*multierror.Error) []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, registryOAuth2AccessTokenMap map[string]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, registryOAuth2AccessTokenMap map[string]string) []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, registryOAuth2AccessTokenMap map[string]string) (*models.TrivyResults, error)

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

func ScanImages

func ScanImages(imgScanner ImageScannerFunc, images []models.Image, maxConcurrentScans int, extraFlags string, registryOAuth2AccessTokenMap map[string]string) []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 ImageScannerFunc

type ImageScannerFunc = func(extraFlags, pullRef string, registryOAuth2AccessTokenMap map[string]string) (*models.TrivyResults, error)

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