ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Osv.Provenance

Description

Advisory source provenance and age diagnostics stored in the artifact metadata.

Synopsis

The recorded sources

data AdvisoryProvenance Source #

Source declarations. Missing values and keys from older artifacts remain Nothing.

Constructors

AdvisoryProvenance 

Fields

noProvenance :: AdvisoryProvenance Source #

Nothing recorded, which is what an artifact compiled before these keys decodes to.

provenanceRows :: AdvisoryProvenance -> [(Text, Text)] Source #

The meta rows one provenance writes. A value the source did not supply writes no row.

decodeProvenance :: [(Text, Text)] -> AdvisoryProvenance Source #

Decode artifact metadata, treating absent, overlong, and unreadable values as missing.

How a source is recorded

data SourcePathRecording Source #

Whether an artifact records each source's path. Every consumer and every reader of the bucket can read the artifact.

Constructors

FingerprintSourcePath

Record only the path's SHA-256, so a credential written into the path stays out of the artifact.

RecordSourcePath

Record the URL as credentialFreeUrl leaves it, path included.

data RecordedSource Source #

A source as an artifact records it. Userinfo, the query and the fragment are never part of it.

Constructors

RecordedSource 

Fields

data RecordedPath Source #

A source's path, or the fingerprint that stands in for it.

Constructors

PathAsFetched Text

The path as fetched.

PathSha256 Text

The SHA-256 of the path's UTF-8 bytes, in lowercase hex.

Instances

Instances details
Show RecordedPath Source # 
Instance details

Defined in Ecluse.Core.Osv.Provenance

Eq RecordedPath Source # 
Instance details

Defined in Ecluse.Core.Osv.Provenance

recordSource :: SourcePathRecording -> Text -> RecordedSource Source #

Record a fetched URL. A changed path changes the record under either choice.

renderRecordedSource :: RecordedSource -> Text Source #

The stored form. A fingerprint follows a slash, so dialledAuthorityLabel still reads the authority.

Source timestamps

parseSourceTime :: Text -> Maybe UTCTime Source #

Read RFC 3339, the EPSS offset form, or a bare date at UTC midnight. Invalid values remain absent.

parseHttpDate :: Text -> Maybe UTCTime Source #

Read the provenance date format, retaining its timezone and whitespace acceptance.

lastModifiedOf :: [ByteString] -> Maybe UTCTime Source #

The instant a response's Last-Modified names. An absent or unreadable header records nothing.

The quiet-time reading

data QuietTime Source #

Per-source age thresholds for the Pilot alarm.

Constructors

QuietTime 

Fields

Instances

Instances details
Show QuietTime Source # 
Instance details

Defined in Ecluse.Core.Osv.Provenance

Eq QuietTime Source # 
Instance details

Defined in Ecluse.Core.Osv.Provenance

defaultQuietTime :: NominalDiffTime Source #

Seven days, the threshold a source with no configured value of its own is judged by.

data ProvenanceSource Source #

Which upstream an age was read from.

Constructors

OsvExport

The ecosystem's advisory export, aged by its newest record modified.

EpssFeed

The EPSS feed, aged by its declared score_date.

data SourceAge Source #

One source's age at an instant, with the threshold that decides whether it is quiet.

Constructors

SourceAge 

Fields

Instances

Instances details
Show SourceAge Source # 
Instance details

Defined in Ecluse.Core.Osv.Provenance

Eq SourceAge Source # 
Instance details

Defined in Ecluse.Core.Osv.Provenance

sourceAges :: UTCTime -> QuietTime -> AdvisoryProvenance -> [SourceAge] Source #

Report ages only for sources with recorded timestamps.

sourceQuiet :: SourceAge -> Bool Source #

Whether this source has gone longer than its threshold without changing.

renderSourceAge :: SourceAge -> Text Source #

The age as an operator reads it, in the seconds its threshold is configured in.