ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Osv.Compile

Description

Compile OSV advisories and EPSS scores into the artifact consumed by CVE sync. Every pass attempts the EPSS feed, and the ecosystem's EpssRequirement decides whether a failed feed stops publication or leaves the artifact recording unavailable enrichment.

A pass compiles into an exclusive temporary file, the candidate, which replaces the canonical file only once its caller promotes it, so a refused publication leaves the previous artifact in place.

Synopsis

Documentation

data CompileSources Source #

The two upstreams one compile pass reads: the ecosystem's advisories, and the scores it joins onto them.

mkCompileSources :: SourcePathRecording -> String -> String -> CompileSources Source #

The sources one pass reads. Each recorded form derives from its fetched URL, under the one choice given.

csOsvExportUrl :: CompileSources -> String Source #

The ecosystem's OSV export archive (osvExportUrl).

csEpssFeedUrl :: CompileSources -> String Source #

The EPSS daily feed, from the configured advisories.epssFeedUrl.

csOsvRecorded :: CompileSources -> RecordedSource Source #

The export as its artifact records it.

csEpssRecorded :: CompileSources -> RecordedSource Source #

The feed as its artifact records it.

The candidate a publication decides on

data OsvCandidate Source #

A compiled artifact in its exclusive temporary file, with the facts its publication compares.

withOsvCandidate :: (MonadResource m, MonadMask m, MonadUnliftIO m, KatipContext m) => AdvisoryCompileMetricsPort -> Maybe TracerProvider -> Manager -> FilePath -> OsvEcosystem -> EpssRequirement -> CompileSources -> QuietTime -> (OsvCandidate -> m a) -> m a Source #

Compile one ecosystem into a candidate for use, which may promote it. A refused compile throws before use runs.

stampCandidateNonce :: MonadIO m => OsvCandidate -> PublicationNonce -> m () Source #

Write this attempt's nonce into the candidate. The nonce is fixed width, so the file keeps its size.

promoteCandidate :: MonadIO m => OsvCandidate -> m FilePath Source #

Replace the canonical artifact with the candidate, and return its path.

Feed downloads

newFeedManagerWithIdentity :: ByteString -> IO Manager Source #

Reuse a precomputed outbound identity for both advisory feeds.

Refusals and rows

data PilotEpssRequired Source #

A required EPSS feed failed, so the compile published nothing. It names the feed by host:port, as the URL can carry a credential.

Constructors

PilotEpssRequired 

Fields

data PilotOsvFetchFailed Source #

The OSV export fetch failed, after any retries. It names the feed by host:port, as a redirect can reach a URL that carries a credential.

Constructors

PilotOsvFetchFailed 

Fields

osvToRow :: ExtractedOsv -> (Text, Text, Maybe Text, Maybe Text, Maybe Text, Maybe Double, Maybe Double) Source #

One extracted segment as its artifact row. The upper bound fills at most one of fixed_version and last_affected_version.