trivy

package
v0.0.0-...-ce22054 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package trivy is used to access trivy server to find vulnerabilities for images

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(remoteURL string) (s *client.Scanner, err error)

NewClient returns a new Trivy client

func Run

func Run(scanner *client.Scanner, url string, imageName string, registry registries.ImageRegistry) (r *pkgReport.Report, err error)

Run gets vulnerability details about an image from a trivy server, and returns a trivy report

the report is further processed by the caller

Types

type Config

type Config struct {
	URL string `koanf:"url"`
}

Config contains all the information to talk to Trivy

type Scanner

type Scanner interface {
	GetVulnerabilities(fullPath, image, url string) ([]vulnerabilities.Vulnerability, error)
	GetResults(fullPath, image, url string) (report.Results, error)
}

Scanner is an interface that wraps calls to Xray

func NewTrivy

func NewTrivy(config Config, registries registries.ImageRegistries) (Scanner, error)

NewTrivy constructs a new Trivy client It returns an implementation of the Trivy client represented as the Scanner interface

type TrivyClient

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

func (*TrivyClient) GetResults

func (t *TrivyClient) GetResults(fullPath string, image string, url string) (r report.Results, err error)

GetResults returns results as they come from Trivy

func (*TrivyClient) GetVulnerabilities

func (t *TrivyClient) GetVulnerabilities(fullPath string, image string, url string) ([]vulnerabilities.Vulnerability, error)

GetVulnerabilities returns Trivy results as generic Vulnerabilities instead of in the Trivy format It returns empty Image list on error

Jump to

Keyboard shortcuts

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