index

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDocument

func WithDocument(doc *vex.VEX) constructorFunc

WithDocument adds all the statements in a document to the index

func WithStatements

func WithStatements(statements []*vex.Statement) constructorFunc

WithStatements adds statements to a newly created index

Types

type Filter

type Filter func() map[*vex.Statement]struct{}

Filter is an internal object that abstracs a function that when called, extracts vex statements from an index, returning them in a slice ordered by pointers so the matching vex statements.

Filters are used by the index `Matches()` function which calls the filters, deduplicates the results and returns the collection of matching statements.

type FilterFunc

type FilterFunc func(*StatementIndex) Filter

A FilterFunc is a function that returns a Filter when called. FilterFuncs are meant to be used as arguments to the `Matches()` index function.

func WithProduct

func WithProduct(prod *vex.Product) FilterFunc

WithProduct returns a filter that indexes a product by its ID, identifiers and hashes.

func WithSubcomponent

func WithSubcomponent(subc *vex.Subcomponent) FilterFunc

WithSubcomponent adds a subcomponent filter to the search criteria, indexing by ID, identifiers and hashes.

func WithVulnerability

func WithVulnerability(vuln *vex.Vulnerability) FilterFunc

WithVulnerability returns a filter that matches a vulnerability.

type StatementIndex

type StatementIndex struct {
	// contains filtered or unexported fields
}

StatementIndex is the OpenVEX statement indexer. An index reads into memory vex statements and catalogs them by the fields in their components (vulnerability, product, subcomponents).

The index exposes a StatementIndex.Match() function that takes in Filters to return indexed statements that match the filter criteria.

func New

func New(funcs ...constructorFunc) (*StatementIndex, error)

New creates a new VEX index with the specified functions

func (*StatementIndex) IndexStatements

func (si *StatementIndex) IndexStatements(statements []*vex.Statement)

IndexStatements indexes all the passed statements by cataloguing the fields in the product, vulnerability and subcomponents.

func (*StatementIndex) Matches

func (si *StatementIndex) Matches(filterfunc ...FilterFunc) []*vex.Statement

Matches applies filters to the index to look for matching statements

Jump to

Keyboard shortcuts

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