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
- func Module() sdkplugin.Module
- type Matcher
- func (a Matcher) Applicable(_ context.Context, _ sdkplugin.MatchRequest) (bool, error)
- func (a Matcher) Descriptor() sdkplugin.MatcherDescriptor
- func (a Matcher) Match(_ context.Context, req sdkplugin.MatchRequest) (sdkplugin.MatchResult, error)
- func (a Matcher) Ready(context.Context, sdkplugin.MatchRequest) error
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 ¶
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 (Matcher) Descriptor ¶
func (a Matcher) Descriptor() sdkplugin.MatcherDescriptor
Descriptor returns the registration metadata for the Grype matcher.
func (Matcher) Match ¶
func (a Matcher) Match(_ context.Context, req sdkplugin.MatchRequest) (sdkplugin.MatchResult, error)
Match attaches Grype vulnerability matches to packages in the graph.
Click to show internal directories.
Click to hide internal directories.