trivy

package
v0.9.19 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanImage

func ScanImage(task model.PharosScanTask, scanEngine *TrivyScanner, kvc *cache.PharosCache, logger *zerolog.Logger) (model.PharosScanResult, []byte, []byte, error)

execute scan with grype scanner

Types

type TrivySbomCreator

type TrivySbomCreator struct {
	Generator string

	HomeDir      string
	GeneratorBin string
	Timeout      time.Duration
	// contains filtered or unexported fields
}

Create cyclonedx from artifact

func NewTrivySbomCreator

func NewTrivySbomCreator(timeout time.Duration, logger *zerolog.Logger) (*TrivySbomCreator, error)

create new sbom generator using syft

func (*TrivySbomCreator) CreateSbom

func (rx *TrivySbomCreator) CreateSbom(task model.PharosScanTask, format string) (trivytype.TrivySbomType, []byte, error)

download image, create sbom in chosen format, e.g. "cyclonedx"

type TrivyScanner

type TrivyScanner struct {
	Engine      string
	HomeDir     string
	ScannerBin  string
	ScanTimeout time.Duration

	// version / status
	ScannerVersion  string
	DatabaseVersion string
	DatabaseUpdated time.Time
	// contains filtered or unexported fields
}

trivy vulnerability scanner

func NewTrivyScanner

func NewTrivyScanner(scanTimeout time.Duration, updateDb bool, vulnDbDir string, logger *zerolog.Logger) (*TrivyScanner, error)

create trivy scanner

func (*TrivyScanner) GetVersion

func (rx *TrivyScanner) GetVersion() error

check trivy local database status, update DbState

func (*TrivyScanner) ScannerName

func (rx *TrivyScanner) ScannerName() string

func (*TrivyScanner) UpdateDatabase

func (rx *TrivyScanner) UpdateDatabase() error

run trivy database update check online if an update is available and download it if required

func (*TrivyScanner) VulnScanSbom

func (rx *TrivyScanner) VulnScanSbom(sbom []byte) (trivytype.TrivyScanType, []byte, error)

scan cyclondex sbom with trivy

type TrivyVersion

type TrivyVersion struct {
	Version         string `json:"version"`
	VulnerabilityDb struct {
		Version      int       `json:"version"`
		NextUpdate   time.Time `json:"NextUpdate"`
		UpdatedAt    time.Time `json:"UpdatedAt"`
		DownloadedAt time.Time `json:"DownloadedAt"`
	} `json:"VulnerabilityDB"`
}

trivy version

func (*TrivyVersion) FromBytes

func (rx *TrivyVersion) FromBytes(input []byte) error

Jump to

Keyboard shortcuts

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