ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Osv.Advisory

Synopsis

Documentation

data OsvAffected Source #

Constructors

OsvAffected 

Fields

data OsvRange Source #

Constructors

OsvRange 

Instances

Instances details
FromJSON OsvRange Source # 
Instance details

Defined in Ecluse.Core.Osv.Advisory

Show OsvRange Source # 
Instance details

Defined in Ecluse.Core.Osv.Advisory

Eq OsvRange Source # 
Instance details

Defined in Ecluse.Core.Osv.Advisory

data OsvEvent Source #

One event in a range's ordered event list. An event carries exactly one bound: introduced opens the affected interval (inclusive), fixed closes it below the fix (exclusive), and last_affected closes it at an inclusive upper bound. The two upper bounds are genuinely different -- fixed 2.0 excludes 2.0, last_affected 2.0 includes it -- so they are decoded and carried separately.

Instances

Instances details
FromJSON OsvEvent Source # 
Instance details

Defined in Ecluse.Core.Osv.Advisory

Show OsvEvent Source # 
Instance details

Defined in Ecluse.Core.Osv.Advisory

Eq OsvEvent Source # 
Instance details

Defined in Ecluse.Core.Osv.Advisory

newtype OsvDatabaseSpecific Source #

The subset of an advisory's database_specific block the pipeline consumes.

Constructors

OsvDatabaseSpecific 

Fields

  • dbsSeverity :: Maybe Text

    The source database's qualitative severity label (for GHSA-sourced npm advisories: LOW, MODERATE, HIGH, or CRITICAL).

data OsvSeverityEntry Source #

One entry of an advisory's severity array: a scoring-system tag (for example CVSS_V3) and its value. For the CVSS systems the value is the vector string, not a number; the numeric base score is computed from it (advisorySeverity).

Constructors

OsvSeverityEntry 

Fields

data ExtractedOsv Source #

One affected segment of one package, flattened for storage: the advisory identity and severity carried alongside the interval bounds. Each ExtractedOsv becomes a row of the artifact's ranges table.

The bounds mirror OSV's own model: extIntroduced is the inclusive lower bound (Nothing == from the beginning); the upper bound is extFixed (exclusive) or extLastAffected (inclusive) or neither (open-ended). An exact enumerated version becomes a point segment (introduced == last_affected == v).

Constructors

ExtractedOsv 

Fields

Instances

Instances details
Show ExtractedOsv Source # 
Instance details

Defined in Ecluse.Core.Osv.Advisory

Eq ExtractedOsv Source # 
Instance details

Defined in Ecluse.Core.Osv.Advisory

advisorySeverity :: OsvAdvisory -> Maybe Double Source #

The advisory's CVSS base score, normalised to a number at ingest so the stored artifact holds a single comparable form and the reader needs no parsing.

OSV carries severity as a CVSS vector string, not a number, so the score is computed from it with the Security.CVSS library (the highest, when several vectors parse). When no vector parses, the source database's qualitative label (dbsSeverity) is mapped to its band ceiling (ghsaSeverityCeiling). Nothing when the advisory offers neither.

extractFromAdvisory :: OsvAdvisory -> [ExtractedOsv] Source #

Flatten an advisory into one ExtractedOsv per affected segment: every range segment of every affected package, plus each exactly-enumerated version as a point. An advisory with neither ranges nor versions yields nothing.

osvExportUrl :: Text -> Text -> String Source #

An ecosystem's advisory export under an OSV-layout base URL (<base>/<ecosystem>/all.zip): a zip archive of every advisory currently published for the ecosystem. The base comes from configuration (osvExportBaseUrl), so a moved or mirrored upstream never needs a new binary; a trailing slash on the base is tolerated.

>>> osvExportUrl "https://osv-vulnerabilities.storage.googleapis.com/" "npm"
"https://osv-vulnerabilities.storage.googleapis.com/npm/all.zip"