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 ¶
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 ¶
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 ¶
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 ¶
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.