csaf

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 21 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 csaf imports vendor VEX statements from CSAF 2.0 providers: it discovers the documents of a provider-metadata.json, a ROLIE feed or a single document URL, checks their integrity (hash files, detached OpenPGP signatures; CSAF 2.0 section 7) and reads their not_affected and fixed product statuses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	URL        string
	TrackingID string
	Released   time.Time // current_release_date
	Statements []models.VEXFeedStatement
}

Document is an imported CSAF document.

func ParseDocument

func ParseDocument(body []byte, url string) (*Document, error)

ParseDocument reads the not_affected and fixed statements of a CSAF 2.0 csaf_vex or csaf_security_advisory document fetched from url. Products are identified by their purl (normalized with sbom.NormalizePURL; versionless or unparsable purls are dropped), else their CPE; a relationship product without identifiers takes those of its product_reference. known_not_affected becomes not_affected with the justification of the product's flag and the impact threat details, and is skipped when it has neither; fixed and first_fixed become fixed with the vendor_fix remediation details as action. The error's message is safe to show to an administrator.

type Fetcher

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

Fetcher fetches CSAF providers over an SSRF-safe client.

func NewFetcher

func NewFetcher(client *http.Client) *Fetcher

NewFetcher returns a Fetcher using client; nil uses an SSRF-safe client. Redirects from https to another scheme are refused whatever the client.

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(ctx context.Context, src Source) (*Result, error)

Fetch imports the documents of src changed after src.Since. A document that cannot be fetched, fails its integrity check or cannot be read is rejected and the run goes on; a failure of the source itself (the entry point, a ROLIE feed or a changes.csv) is an error, whose message is safe to show to an administrator.

type Rejection

type Rejection struct {
	URL    string
	Reason string
}

Rejection is a document that failed its integrity check or could not be fetched or read. Reason is safe to show to an administrator.

type Result

type Result struct {
	Documents []Document
	Rejected  []Rejection
	// Cursor is the newest change time of the accepted documents (the ROLIE
	// entry's updated, the changes.csv time, else current_release_date), to
	// pass as the next Source.Since; nil when no document was accepted.
	Cursor *time.Time
}

Result is the outcome of one Fetch.

type Source

type Source struct {
	// URL is a provider-metadata.json, a ROLIE feed or a single CSAF document.
	URL string
	// RequireSignature rejects documents without a valid OpenPGP signature.
	RequireSignature bool
	// PGPKeys are armored public keys the signatures are checked against;
	// empty uses the provider metadata's public_openpgp_keys whose
	// fingerprint matches.
	PGPKeys string
	// Since skips the documents not changed after it (nil: all).
	Since *time.Time
}

Source is a CSAF provider to import.

Jump to

Keyboard shortcuts

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