osv

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 12 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

Index

Constants

View Source
const (
	DefaultBaseURL = "https://api.osv.dev"
)

Variables

This section is empty.

Functions

func BaseScoreV3

func BaseScoreV3(vector string) float64

BaseScoreV3 computes the CVSS v3.0/v3.1 base score from a vector string. Returns 0 when the vector is not a complete v3 base vector.

func IsLanguagePackage

func IsLanguagePackage(p model.Package) bool

func Overlay

func Overlay(ctx context.Context, c *Client, inventory []model.Package, known map[string]bool) ([]model.Finding, error)

Overlay queries OSV for the inventory and returns findings not already identified by grype. known holds every id and alias grype reported.

func SeverityFromScore

func SeverityFromScore(s float64) string

Types

type Affected

type Affected struct {
	Package  AffectedPackage `json:"package"`
	Ranges   []Range         `json:"ranges"`
	Versions []string        `json:"versions"`
}

type AffectedPackage

type AffectedPackage struct {
	Ecosystem string `json:"ecosystem"`
	Name      string `json:"name"`
	Purl      string `json:"purl"`
}

type Client

type Client struct {
	BaseURL     string
	HTTP        *http.Client
	Concurrency int
	UserAgent   string
}

func NewClient

func NewClient() *Client

func (*Client) QueryBatch

func (c *Client) QueryBatch(ctx context.Context, purls []string) ([][]string, error)

QueryBatch returns, for each purl (with version), the OSV ids affecting it.

func (*Client) Vuln

func (c *Client) Vuln(ctx context.Context, id string) (*Vuln, error)

type Range

type Range struct {
	Type   string              `json:"type"`
	Events []map[string]string `json:"events"`
}

type Reference

type Reference struct {
	Type string `json:"type"`
	URL  string `json:"url"`
}

type Severity

type Severity struct {
	Type  string `json:"type"`
	Score string `json:"score"`
}

type Vuln

type Vuln struct {
	ID               string         `json:"id"`
	Aliases          []string       `json:"aliases"`
	Summary          string         `json:"summary"`
	Details          string         `json:"details"`
	Modified         string         `json:"modified"`
	Published        string         `json:"published"`
	Withdrawn        string         `json:"withdrawn"`
	Severity         []Severity     `json:"severity"`
	Affected         []Affected     `json:"affected"`
	References       []Reference    `json:"references"`
	DatabaseSpecific map[string]any `json:"database_specific"`
}

Jump to

Keyboard shortcuts

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