| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data CompileSources
- mkCompileSources :: SourcePathRecording -> String -> String -> CompileSources
- csOsvExportUrl :: CompileSources -> String
- csEpssFeedUrl :: CompileSources -> String
- csOsvRecorded :: CompileSources -> RecordedSource
- csEpssRecorded :: CompileSources -> RecordedSource
- data OsvCandidate
- candidatePath :: OsvCandidate -> FilePath
- candidateDestination :: OsvCandidate -> FilePath
- candidateFacts :: OsvCandidate -> CandidateFacts
- withOsvCandidate :: (MonadResource m, MonadMask m, MonadUnliftIO m, KatipContext m) => AdvisoryCompileMetricsPort -> Maybe TracerProvider -> Manager -> FilePath -> OsvEcosystem -> EpssRequirement -> CompileSources -> QuietTime -> (OsvCandidate -> m a) -> m a
- stampCandidateNonce :: MonadIO m => OsvCandidate -> PublicationNonce -> m ()
- promoteCandidate :: MonadIO m => OsvCandidate -> m FilePath
- newFeedManagerWithIdentity :: ByteString -> IO Manager
- data PilotEpssRequired = PilotEpssRequired {}
- data PilotOsvFetchFailed = PilotOsvFetchFailed {}
- osvToRow :: ExtractedOsv -> (Text, Text, Maybe Text, Maybe Text, Maybe Text, Maybe Double, Maybe Double)
Documentation
data CompileSources Source #
The two upstreams one compile pass reads: the ecosystem's advisories, and the scores it joins onto them.
Instances
| Show CompileSources Source # | |
Defined in Ecluse.Core.Osv.Compile Methods showsPrec :: Int -> CompileSources -> ShowS # show :: CompileSources -> String # showList :: [CompileSources] -> ShowS # | |
| Eq CompileSources Source # | |
Defined in Ecluse.Core.Osv.Compile Methods (==) :: CompileSources -> CompileSources -> Bool # (/=) :: CompileSources -> CompileSources -> Bool # | |
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.
candidatePath :: OsvCandidate -> FilePath Source #
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
| |
Instances
| Exception PilotEpssRequired Source # | |
Defined in Ecluse.Core.Osv.Compile Methods toException :: PilotEpssRequired -> SomeException # fromException :: SomeException -> Maybe PilotEpssRequired # | |
| Show PilotEpssRequired Source # | |
Defined in Ecluse.Core.Osv.Compile Methods showsPrec :: Int -> PilotEpssRequired -> ShowS # show :: PilotEpssRequired -> String # showList :: [PilotEpssRequired] -> ShowS # | |
| Eq PilotEpssRequired Source # | |
Defined in Ecluse.Core.Osv.Compile Methods (==) :: PilotEpssRequired -> PilotEpssRequired -> Bool # (/=) :: PilotEpssRequired -> PilotEpssRequired -> Bool # | |
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 | |
Instances
| Exception PilotOsvFetchFailed Source # | |
Defined in Ecluse.Core.Osv.Compile | |
| Show PilotOsvFetchFailed Source # | |
Defined in Ecluse.Core.Osv.Compile Methods showsPrec :: Int -> PilotOsvFetchFailed -> ShowS # show :: PilotOsvFetchFailed -> String # showList :: [PilotOsvFetchFailed] -> ShowS # | |
| Eq PilotOsvFetchFailed Source # | |
Defined in Ecluse.Core.Osv.Compile Methods (==) :: PilotOsvFetchFailed -> PilotOsvFetchFailed -> Bool # (/=) :: PilotOsvFetchFailed -> PilotOsvFetchFailed -> Bool # | |