Documentation
¶
Overview ¶
Package grypedb provides a vulnerability source backed by the Grype vulnerability database. The database is a SQLite file that can be downloaded from Anchore's CDN or used locally.
Index ¶
- Constants
- func Download(ctx context.Context, destDir string) (string, error)
- type Option
- type Source
- func (s *Source) Close() error
- func (s *Source) Get(ctx context.Context, id string) (*vulns.Vulnerability, error)
- func (s *Source) Name() string
- func (s *Source) Query(ctx context.Context, p *purl.PURL) ([]vulns.Vulnerability, error)
- func (s *Source) QueryBatch(ctx context.Context, purls []*purl.PURL) ([][]vulns.Vulnerability, error)
Constants ¶
const ( // LatestDBURL is the URL to fetch the latest database listing LatestDBURL = "https://grype.anchore.io/databases/v6/listing.json" DefaultTimeout = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*Source)
Option configures a Source.
func WithAutoDownload ¶
func WithAutoDownload() Option
WithAutoDownload enables automatic downloading of the database if missing.
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client for downloading the database.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source implements vulns.Source using a local Grype database.
func New ¶
New creates a new Grype database source. If dbPath points to a directory, it looks for vulnerability.db inside it. If dbPath points to a file, it uses that file directly. With WithAutoDownload(), downloads the database if missing.
func (*Source) QueryBatch ¶
func (s *Source) QueryBatch(ctx context.Context, purls []*purl.PURL) ([][]vulns.Vulnerability, error)
QueryBatch queries multiple packages.