audit

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package audit provides npm registry audit API integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client handles npm audit API requests.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new npm audit client.

func (*Client) AuditDependencies

func (c *Client) AuditDependencies(deps []types.Dependency) ([]types.VulnerabilityFinding, error)

AuditDependencies audits a list of dependencies.

func (*Client) AuditSinglePackage

func (c *Client) AuditSinglePackage(name, version string) ([]types.VulnerabilityInfo, error)

AuditSinglePackage audits a single package.

type OSVClient

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

OSVClient audits dependencies for known vulnerabilities via OSV.dev, which spans npm, PyPI and more in a single API. querybatch returns only vuln ids per query, so confirmed hits are hydrated through the per-vuln endpoint to recover severity, title and fixed versions.

func NewOSVClient

func NewOSVClient(opts ...OSVOption) *OSVClient

NewOSVClient creates a new OSV.dev audit client.

func (*OSVClient) AuditDependencies

func (c *OSVClient) AuditDependencies(deps []types.Dependency) ([]types.VulnerabilityFinding, error)

AuditDependencies audits a list of dependencies, returning one finding per (package, version, vulnerability).

func (*OSVClient) AuditSinglePackage

func (c *OSVClient) AuditSinglePackage(ecosystem, name, version string) ([]types.VulnerabilityInfo, error)

AuditSinglePackage audits a single package and returns simplified records.

type OSVOption

type OSVOption func(*OSVClient)

OSVOption configures an OSVClient.

func WithOSVHTTPClient added in v1.16.0

func WithOSVHTTPClient(c *http.Client) OSVOption

WithOSVHTTPClient sets a custom HTTP client.

func WithOSVURLs added in v1.16.0

func WithOSVURLs(queryURL, vulnURL string) OSVOption

WithOSVURLs sets custom query and vuln endpoints (for testing).

type Option

type Option func(*Client)

Option configures a Client.

Jump to

Keyboard shortcuts

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