vex

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package vex reads OpenVEX v0.2.0 documents and suppresses advisories by vulns.ignore entries and VEX statements.

Index

Constants

View Source
const (
	StatusNotAffected        = "not_affected"
	StatusAffected           = "affected"
	StatusFixed              = "fixed"
	StatusUnderInvestigation = "under_investigation"
)

OpenVEX statuses.

View Source
const Context = "https://openvex.dev/ns/v0.2.0"

Context is the @context of an OpenVEX v0.2.0 document.

View Source
const DateLayout = time.DateOnly

DateLayout is how a vulns.ignore entry writes its until date.

Variables

This section is empty.

Functions

func Write

func Write(w io.Writer, d Document) error

Write writes d as indented JSON with its @context, version 1 when it has none, and an @id that hashes its content without the timestamp, as govulncheck does: the same statements give the same @id.

Types

type Component

type Component struct {
	ID            string            `json:"@id,omitempty"`
	Identifiers   map[string]string `json:"identifiers,omitempty"`
	Subcomponents []Component       `json:"subcomponents,omitempty"`
}

Component is a product or a subcomponent, named by an IRI such as a purl, or by identifiers.

type Document

type Document struct {
	Context    string      `json:"@context"`
	ID         string      `json:"@id"`
	Author     string      `json:"author"`
	Timestamp  time.Time   `json:"timestamp"`
	Version    int         `json:"version"`
	Tooling    string      `json:"tooling,omitempty"`
	Statements []Statement `json:"statements"`
}

Document is an OpenVEX v0.2.0 document, with the fields relgap reads and writes.

func Parse

func Parse(b []byte) (Document, error)

Parse decodes an OpenVEX v0.2.0 document. Another @context, such as that of the older v0.0.1 format whose vulnerability is a string, is an error.

type File

type File struct {
	Path     string // slash-separated
	Document Document
}

File is a document read from a path.

func Read

func Read(path string) (File, error)

Read reads the OpenVEX v0.2.0 document at path.

type Ignore

type Ignore struct {
	ID     string
	Reason string
	Until  string   // a date in [DateLayout]; empty never expires
	Tools  []string // globs on the tool name, * spanning any characters; empty means every tool
}

Ignore is a vulns.ignore entry: an advisory ID or alias, why it is accepted, the last day it applies and the tools it applies to.

type Rules

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

Rules suppresses advisories by vulns.ignore entries and OpenVEX statements. It is safe for concurrent use and counts which entries matched.

func New

func New(ignores []Ignore, files []File, today time.Time) (*Rules, error)

New returns the rules of the ignore entries in effect on day today and the statements of files. An entry whose until date is before today has expired: it matches nothing and Rules.Expired lists it.

func (*Rules) Covers

func (r *Rules) Covers(s enrich.Subject, names []string) bool

Covers reports whether the rules suppress the advisory named names for s, without counting the match as a use.

func (*Rules) Expired

func (r *Rules) Expired() []Ignore

Expired returns the ignore entries whose until date has passed, in config order.

func (*Rules) Suppress

func (r *Rules) Suppress(s enrich.Subject, names []string) *enrich.Suppression

Suppress returns why the advisory named names is suppressed for s, or nil: the first ignore entry whose ID is one of names and whose tools match, else the latest statement about it and one of s's purls when its status is not_affected or fixed.

func (*Rules) Unused

func (r *Rules) Unused() []Ignore

Unused returns the ignore entries in effect that suppressed nothing, in config order.

type Statement

type Statement struct {
	Vulnerability   Vulnerability `json:"vulnerability"`
	Timestamp       *time.Time    `json:"timestamp,omitempty"`
	Products        []Component   `json:"products,omitempty"`
	Status          string        `json:"status"`
	Justification   string        `json:"justification,omitempty"`
	ImpactStatement string        `json:"impact_statement,omitempty"`
	ActionStatement string        `json:"action_statement,omitempty"`
}

Statement says how a vulnerability affects products.

type Vulnerability

type Vulnerability struct {
	ID          string   `json:"@id,omitempty"`
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Aliases     []string `json:"aliases,omitempty"`
}

Vulnerability names the vulnerability a statement is about.

Jump to

Keyboard shortcuts

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