ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Cve.Internal

Description

Advisory handles, SQLite verification, and masked ownership transfer. The public Ecluse.Core.Cve module curates these operations.

Synopsis

Documentation

data AdvisoryRange Source #

An advisory segment with nullable CVSS and EPSS scores and verbatim version bounds. The introduced bound is inclusive. Absence means the segment starts at the beginning.

Instances

Instances details
Show AdvisoryRange Source # 
Instance details

Defined in Ecluse.Core.Cve.Internal

Eq AdvisoryRange Source # 
Instance details

Defined in Ecluse.Core.Cve.Internal

data CveDbRejected Source #

Why the hardened open refused an artifact before building a handle over it. A rejection is a value, not a fault, so the caller can keep the last known-good database.

Constructors

CveDbWrongEpoch Int

The artifact's user_version differs from osvSchemaEpoch.

CveDbIntegrityFailed [Text]

SQLite refused the file or reported integrity faults, carrying its error or report.

CveDbSchemaNonConformant Text

A required relation is absent, non-strict, or lacks a column with its required type.

CveDbEcosystemMismatch (Maybe Text)

The ecosystem marker differs from the requested ecosystem or is absent.

CveDbEpssNotEstablished

Required feed enrichment lacks the exact success marker.

Instances

Instances details
Show CveDbRejected Source # 
Instance details

Defined in Ecluse.Core.Cve.Internal

Eq CveDbRejected Source # 
Instance details

Defined in Ecluse.Core.Cve.Internal

verifyConnection :: Ecosystem -> EpssRequirement -> Connection -> IO (Either CveDbRejected ()) Source #

Harden and verify the connection. Its owner remains responsible for closing it.

acceptConnection :: IO Connection -> (Connection -> IO ()) -> (Connection -> IO (Either CveDbRejected a)) -> (Connection -> a -> IO b) -> IO (Either CveDbRejected b) Source #

Acquire masked, verify under the caller's mask state, then transfer ownership to the masked continuation.

transferCveDb :: Ecosystem -> EpssRequirement -> FilePath -> (CveDb -> IO a) -> IO (Either CveDbRejected a) Source #

Transfer an accepted database to a masked owner. Verification retains the caller's masking state.

data CveDb Source #

One opened artifact. Its holder owns the connection's lifetime, and hands a consumer cveDbLookup only.

Constructors

CveDb 

Fields

  • cveDbLookup :: CveLookup

    The view consumers query through.

  • cveDbClose :: IO ()

    Release the connection. Owner-only, and never throws, since the connection is going away either way.

  • cveDbMeta :: [(Text, Text)]

    The artifact's meta provenance rows, snapshotted at open and key-sorted for the audit trail.

  • cveDbProvenance :: AdvisoryProvenance

    What the artifact records about its sources. An artifact written before those keys decodes as absence.

data CveLookup Source #

Query by canonical package key, with an npm scope inline. A display name is never a query key.

Constructors

CveLookup 

Fields

data CveQueryFault Source #

A database query fault for the rule's resilience policy to classify.

Constructors

CveQueryFault 

Fields

  • cqfQuery :: Text

    Which handle field was asked (advisories-for or covered-names).

  • cqfDetail :: Text

    The rendered SQLError, for the operator's outage report. Never parsed.

advisoriesQuery :: Connection -> Text -> IO [AdvisoryRange] Source #

Every advisory segment recorded against a package name.

coveredNamesQuery :: Connection -> IO [Text] Source #

Every package name this artifact records an advisory against, each once. The name index covers the scan, and the result is what a store sweep intersects its listing with.

toRange :: (Text, Maybe Text, Maybe Text, Maybe Text, Maybe Double, Maybe Double) -> AdvisoryRange Source #

One artifact row as an advisory segment, decoding the two nullable bound columns into the segment's single upper bound.

provenanceQuery :: Connection -> IO [(Text, Text)] Source #

The artifact's meta provenance rows, key-sorted for a deterministic snapshot. It runs only on an accepted connection, so the (Text, Text) decode cannot throw.