plugin

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package grype implements a Matcher that uses the Grype vulnerability library (builtin) or the grype CLI binary (external), selected via build tags.

Index

Constants

View Source
const Name = "grype"

Name is the plugin's identity. It MUST equal the "id" field in bomly-plugin.json — Bomly refuses to load a plugin whose manifest id and runtime descriptor name disagree. It is also the descriptor name the Bomly CLI composition keys on when it embeds this matcher.

Variables

This section is empty.

Functions

func Module

func Module() sdkplugin.Module

Module packages the matcher for both execution modes: Bomly can embed it in-process (the CLI composition constructs Matcher{Logger: ...} directly) or serve it as a managed plugin subprocess (see cmd/bomly-plugin-grype-matcher).

Types

type Matcher

type Matcher struct {
	// DBDir is the directory that contains the Grype vulnerability database.
	// Defaults to the OS cache directory / grype / db.
	DBDir string
	// Logger receives diagnostic messages. Maybe nil (no-op).
	Logger *zap.Logger
	// DistConfigOverride overrides the default distribution config (e.g., LatestURL).
	DistConfigOverride any
	// DisableDBUpdate stops the builtin variant from asking Grype's
	// distribution service for a newer database. The local copy is used as it
	// is, and a missing one is an error. By default the matcher checks at most
	// once per DBUpdateCheckInterval and downloads a newer build when there is
	// one, so an enriched scan does not keep answering from the database it
	// downloaded months ago (bomly-dev/bomly-cli#510).
	DisableDBUpdate bool
	// DBMaxAge is the age past which the builtin variant warns that its
	// database is stale and advisories published since are missing. Zero
	// means Grype's own default of five days.
	DBMaxAge time.Duration
	// DBUpdateCheckInterval bounds how often the builtin variant asks the
	// distribution service for a newer database. Zero means Grype's own
	// default of two hours.
	DBUpdateCheckInterval time.Duration
}

Matcher uses the Grype library or CLI to match packages against a vulnerability database.

func (Matcher) Applicable

func (a Matcher) Applicable(_ context.Context, _ sdkplugin.MatchRequest) (bool, error)

func (Matcher) Descriptor

func (a Matcher) Descriptor() sdkplugin.MatcherDescriptor

Descriptor returns the registration metadata for the Grype matcher.

func (Matcher) Match

Match attaches Grype vulnerability matches to packages in the graph.

func (Matcher) Ready

Ready reports whether the bundled Grype matcher can run. The database may be downloaded during Match on first use, so a missing cache does not make the matcher unavailable.

Jump to

Keyboard shortcuts

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