osv

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 14 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 osv provides CEL helpers for writing policies over OSV results predicates. OSV data nests findings three levels deep:

(results -> packages -> vulnerabilities)

and encodes severity as CVSS vector strings, which makes raw CEL policies verbose and error-prone. These plugin methods flatten the JSON traversal, expose alias aware id matching, and reuse the AMPEL cvss plugin scorer so authors can write intent-level checks.

Index

Constants

This section is empty.

Variables

View Source
var Identity = class.MustParseIdentity("osv@v1")
View Source
var OSVType = cel.ObjectType("osv", traits.ReceiverType)

OSVType is the CEL receiver type backing the `osv` variable.

Functions

This section is empty.

Types

type OSVTool

type OSVTool struct{}

func (*OSVTool) CompileOptions

func (t *OSVTool) CompileOptions() []cel.EnvOption

func (*OSVTool) ConvertToNative

func (*OSVTool) ConvertToNative(_ reflect.Type) (any, error)

func (*OSVTool) ConvertToType

func (t *OSVTool) ConvertToType(typeVal ref.Type) ref.Val

func (*OSVTool) Equal

func (*OSVTool) Equal(_ ref.Val) ref.Val

func (*OSVTool) Functions

func (t *OSVTool) Functions() []cel.EnvOption

Functions returns the CEL member functions exposed on the `osv` object.

Document-level take an OSV results object or a whole predicate, so both osv.vulns(predicate) and osv.vulns(predicate.data) work:

osv.vulns(data)             -> list  : every vulnerability, flattened across
                                       results -> packages -> vulnerabilities
osv.ids(data)               -> list  : the id of every vulnerability
osv.forEcosystem(data, eco) -> list  : vulnerabilities in the ecosystem
osv.forPackage(data, name)  -> list  : vulnerabilities affecting the package

Vulnerability-level (take a single vulnerability from osv.vulns):

osv.aliases(vuln)       -> list  : a vulnerability's id plus its aliases
osv.matchesID(vuln, id) -> bool  : true if id equals the vuln's id or alias
osv.cvss(vuln)          -> double: highest CVSS base score across severities
osv.severityLabel(vuln) -> string: qualitative severity (CRITICAL/HIGH/...)
osv.isFixed(vuln)       -> bool  : true if a fixed version is available
osv.fixedVersions(vuln) -> list  : the versions that fix the vulnerability
osv.purl(vuln)          -> string: the affected package URL
osv.ecosystem(vuln)     -> string: the affected package ecosystem
osv.references(vuln)    -> list  : reference URLs

Enriched field provided by original scanners *stored in database_specific) and which default to 0/false/empty when the scanner did not supply the field:

osv.epss(vuln)  -> double: EPSS exploitation probability (0..1)
osv.risk(vuln)  -> double: scanner risk score
osv.isKEV(vuln) -> bool  : listed in a known-exploited catalog (CISA KEV)
osv.cwes(vuln)  -> list  : associated CWE identifiers

func (*OSVTool) ProgramOptions

func (*OSVTool) ProgramOptions() []cel.ProgramOption

func (*OSVTool) Type

func (*OSVTool) Type() ref.Type

func (*OSVTool) Value

func (t *OSVTool) Value() any

type Plugin

type Plugin struct {
	Tool *OSVTool
}

func New

func New() *Plugin

func (*Plugin) CanRegisterFor

func (p *Plugin) CanRegisterFor(c class.Class) bool

func (*Plugin) Capabilities

func (p *Plugin) Capabilities() []api.Capability

func (*Plugin) Identity

func (p *Plugin) Identity() *class.Identity

func (*Plugin) Library

func (p *Plugin) Library() cel.EnvOption

func (*Plugin) VarValues

func (p *Plugin) VarValues(_ *papi.Policy, _ attestation.Subject, _ []attestation.Predicate) map[string]any

type TypeAdapter

type TypeAdapter struct{}

func (TypeAdapter) NativeToValue

func (TypeAdapter) NativeToValue(value any) ref.Val

Jump to

Keyboard shortcuts

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