osv

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package osv provides a Wrapper for osv plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapInput

func WrapInput(input *filesystem.ScanInput) lockfile.DepFile

WrapInput returns an implementation of OSVs DepFile using a scalibr ScanInput.

Types

type Metadata

type Metadata struct {
	PURLType  string
	Commit    string
	Ecosystem string
	CompareAs string
}

Metadata holds parsing information for packages extracted by an OSV extractor wrapper.

type Wrapper

type Wrapper struct {
	ExtractorName    string
	ExtractorVersion int
	PURLType         string
	Extractor        lockfile.Extractor

	// Optional. A stats.Collector for reporting internal metrics.
	Stats stats.Collector

	// Optional. A config value for the maximum file size this extractor will
	// treat as required in `FileRequired`.
	MaxFileSizeBytes int64
}

Wrapper contains all the data to wrap a osv extractor to a scalibr extractor.

func (Wrapper) Extract

func (e Wrapper) Extract(ctx context.Context, input *filesystem.ScanInput) ([]*extractor.Inventory, error)

Extract wraps the osv Extract method.

func (Wrapper) FileRequired

func (e Wrapper) FileRequired(path string, fileinfo fs.FileInfo) bool

FileRequired returns true if the specified file matches the extractor pattern.

func (Wrapper) Name

func (e Wrapper) Name() string

Name of the extractor.

func (Wrapper) ToCPEs

func (e Wrapper) ToCPEs(i *extractor.Inventory) ([]string, error)

ToCPEs is not applicable as this extractor does not infer CPEs from the Inventory.

func (Wrapper) ToPURL

func (e Wrapper) ToPURL(i *extractor.Inventory) (*purl.PackageURL, error)

ToPURL converts an inventory created by this extractor into a PURL.

func (Wrapper) Version

func (e Wrapper) Version() int

Version of the extractor.

Jump to

Keyboard shortcuts

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