feat(vex): what a supplier states about its component's vulnerabilities (#1025) #1032

Merged
sharang merged 1 commits from feat/supplier-vex into main 2026-11-16 23:09:28 +00:00
9 changed files with 489 additions and 28 deletions

No files matched your search

+18 -8
View File
@@ -671,7 +671,7 @@ impl PipelineOrchestrator {
&repo_id,
));
let yocto_recipes = yocto.recipes;
let mut supplied = self.read_supplier_sboms(repo, &repo_id).await?;
let (mut supplied, supplier_statements) = self.read_supplier_sboms(repo, &repo_id).await?;
supplied.extend(
repo.supplier
.as_ref()
@@ -900,6 +900,8 @@ impl PipelineOrchestrator {
.await;
self.match_supplier_advisories(repo, &repo_id, &mut sbom_entries, &mut cve_alerts)
.await;
// What the supplier states about each, beside the alert (#1025).
crate::pipeline::sbom::supplied::attach(&supplier_statements, &mut cve_alerts);
self.enrich_cves(&repo_id, &mut cve_alerts, &mut sbom_entries)
.await;
@@ -3254,20 +3256,28 @@ impl PipelineOrchestrator {
&self,
repo: &RepoView,
repo_id: &str,
) -> Result<Vec<compliance_core::models::SbomEntry>, AgentError> {
let mut entries = Vec::new();
) -> Result<
(
Vec<compliance_core::models::SbomEntry>,
Vec<crate::pipeline::sbom::supplied::SuppliedStatement>,
),
AgentError,
> {
let (mut entries, mut statements) = (Vec::new(), Vec::new());
for (path, label) in &repo.supplier_sboms {
let (file, id, name) = (path.clone(), repo_id.to_string(), label.clone());
let read = tokio::task::spawn_blocking(move || {
crate::pipeline::sbom::supplied::read(&file, &id, &name)
crate::pipeline::sbom::supplied::read_with_statements(&file, &id, &name)
})
.await
.map_err(|e| AgentError::Other(format!("reading the supplier SBOM {label}: {e}")))?;
entries.extend(read.map_err(|e| {
.map_err(|e| AgentError::Other(format!("reading the supplier SBOM {label}: {e}")))?
.map_err(|e| {
AgentError::Other(format!("the supplier SBOM {label} cannot be read: {e}"))
})?);
})?;
entries.extend(read.entries);
statements.extend(read.statements);
}
Ok(entries)
Ok((entries, statements))
}
/// What the target's build outputs say: the images their SPDX archives
+362 -15
View File
@@ -15,7 +15,7 @@
use std::path::Path;
use compliance_core::models::SbomEntry;
use compliance_core::models::{CveAlert, SbomEntry, SupplierVex};
use super::syft::{canonical_purl, extract_ecosystem_from_purl};
@@ -119,32 +119,171 @@ pub fn parse(
repo_id: &str,
label: &str,
) -> Result<Vec<SbomEntry>, SuppliedSbomError> {
parse_with_statements(bytes, repo_id, label).map(|sbom| sbom.entries)
}
/// A supplier SBOM as read: its components, and what the supplier states
/// about their vulnerabilities (CycloneDX VEX; #1025).
#[derive(Debug)]
pub struct SuppliedSbom {
/// The components, as SBOM entries.
pub entries: Vec<SbomEntry>,
/// The supplier's statements, one per vulnerability and component.
pub statements: Vec<SuppliedStatement>,
}
/// What the supplier states about one vulnerability of one component.
#[derive(Debug, Clone, PartialEq)]
pub struct SuppliedStatement {
/// The vulnerability as the supplier names it (`CVE-…`, `GHSA-…`).
pub vulnerability: String,
/// The component's name, as its SBOM entry has it.
pub name: String,
/// The component's version.
pub version: String,
/// The component's purl, when it has one.
pub purl: Option<String>,
/// The statement.
pub vex: SupplierVex,
}
/// [`read`] with the supplier's statements.
///
/// # Errors
///
/// A [`SuppliedSbomError`] saying why the file is not read.
pub fn read_with_statements(
path: &Path,
repo_id: &str,
label: &str,
) -> Result<SuppliedSbom, SuppliedSbomError> {
let size = std::fs::metadata(path)
.map_err(|e| SuppliedSbomError::Io(e.to_string()))?
.len();
if size > MAX_BYTES {
return Err(SuppliedSbomError::TooLarge);
}
let bytes = std::fs::read(path).map_err(|e| SuppliedSbomError::Io(e.to_string()))?;
parse_with_statements(&bytes, repo_id, label)
}
/// [`parse`] with the supplier's statements.
///
/// # Errors
///
/// A [`SuppliedSbomError`] saying why the document is not read.
pub fn parse_with_statements(
bytes: &[u8],
repo_id: &str,
label: &str,
) -> Result<SuppliedSbom, SuppliedSbomError> {
if bytes.len() as u64 > MAX_BYTES {
return Err(SuppliedSbomError::TooLarge);
}
let text = std::str::from_utf8(bytes)
.map_err(|_| SuppliedSbomError::UnknownFormat(" (not UTF-8 text)".to_string()))?;
let text = text.trim_start_matches('\u{feff}').trim_start();
let components = match text.as_bytes().first() {
let doc = match text.as_bytes().first() {
Some(b'<') => cyclonedx_xml(text)?,
Some(b'{') => json(text)?,
_ => return Err(SuppliedSbomError::UnknownFormat(String::new())),
};
if components.len() > MAX_COMPONENTS {
if doc.components.len() > MAX_COMPONENTS {
return Err(SuppliedSbomError::TooManyComponents);
}
if components.is_empty() {
if doc.components.is_empty() {
return Err(SuppliedSbomError::Empty);
}
Ok(components
let refs: Vec<Option<String>> = doc.components.iter().map(|c| c.bom_ref.clone()).collect();
let entries: Vec<SbomEntry> = doc
.components
.into_iter()
.map(|c| c.entry(repo_id, label))
.collect())
.collect();
let statements = doc
.statements
.into_iter()
.filter_map(|raw| {
let status = SupplierVex::status_of_state(&raw.state)?;
let vex = SupplierVex {
status,
state: raw.state,
justification: raw.justification,
detail: raw.detail,
response: raw.response,
source: label.to_string(),
};
Some((raw.id, raw.refs, vex))
})
.flat_map(|(id, targets, vex)| {
let (refs, entries) = (&refs, &entries);
targets.into_iter().filter_map(move |target| {
let i = refs
.iter()
.position(|r| r.as_deref() == Some(target.as_str()))?;
Some(SuppliedStatement {
vulnerability: id.clone(),
name: entries[i].name.clone(),
version: entries[i].version.clone(),
purl: entries[i].purl.clone(),
vex: vex.clone(),
})
})
})
.collect();
Ok(SuppliedSbom {
entries,
statements,
})
}
/// Give each of `alerts` the supplier's statement about it, if `statements`
/// has one: the same vulnerability (its id or an alias) in the same
/// component (by purl, else by name and version). An alert the supplier no
/// longer states anything about loses its statement.
pub fn attach(statements: &[SuppliedStatement], alerts: &mut [CveAlert]) {
for alert in alerts {
alert.supplier_vex = statements
.iter()
.find(|st| {
let vulnerability =
st.vulnerability == alert.cve_id || alert.aliases.contains(&st.vulnerability);
let component = match (&st.purl, &alert.purl) {
(Some(ours), Some(theirs)) => ours == theirs,
_ => {
st.name.eq_ignore_ascii_case(&alert.affected_package)
&& st.version == alert.affected_version
}
};
vulnerability && component
})
.map(|st| st.vex.clone());
}
}
/// What a document gives: its components and the supplier's raw statements.
#[derive(Debug, Default)]
struct Doc {
components: Vec<Component>,
statements: Vec<RawStatement>,
}
/// One CycloneDX `vulnerabilities[]` entry with an analysis, as written.
#[derive(Debug, Default)]
struct RawStatement {
id: String,
/// The `bom-ref`s of the components it is about (`affects[].ref`).
refs: Vec<String>,
state: String,
justification: Option<String>,
detail: Option<String>,
response: Vec<String>,
}
/// One component as the document names it.
#[derive(Debug, Default, PartialEq)]
struct Component {
bom_ref: Option<String>,
group: Option<String>,
name: String,
version: Option<String>,
@@ -189,19 +328,25 @@ fn is_part(kind: Option<&str>) -> bool {
}
/// A JSON document: CycloneDX or SPDX 2, told apart by their markers.
fn json(text: &str) -> Result<Vec<Component>, SuppliedSbomError> {
fn json(text: &str) -> Result<Doc, SuppliedSbomError> {
let doc: serde_json::Value =
serde_json::from_str(text).map_err(|e| SuppliedSbomError::Malformed {
format: "JSON",
reason: e.to_string(),
})?;
if doc.get("bomFormat").and_then(|v| v.as_str()) == Some("CycloneDX") {
let mut out = Vec::new();
cyclonedx_json_components(doc.get("components"), &mut out)?;
return Ok(out);
let mut components = Vec::new();
cyclonedx_json_components(doc.get("components"), &mut components)?;
return Ok(Doc {
components,
statements: cyclonedx_json_statements(doc.get("vulnerabilities")),
});
}
match doc.get("spdxVersion").and_then(|v| v.as_str()) {
Some(v) if v.starts_with("SPDX-2.") => spdx2(&doc),
Some(v) if v.starts_with("SPDX-2.") => spdx2(&doc).map(|components| Doc {
components,
statements: Vec::new(),
}),
Some(v) => Err(SuppliedSbomError::UnknownFormat(format!(
" ({v} is not read yet)"
))),
@@ -229,6 +374,7 @@ fn cyclonedx_json_components(
if is_part(c.get("type").and_then(|v| v.as_str())) {
if let Some(name) = text("name").filter(|n| !n.trim().is_empty()) {
out.push(Component {
bom_ref: text("bom-ref"),
group: text("group"),
name,
version: text("version"),
@@ -243,6 +389,39 @@ fn cyclonedx_json_components(
Ok(())
}
/// The supplier's statements of a CycloneDX JSON `vulnerabilities` array:
/// those with an analysis state.
fn cyclonedx_json_statements(list: Option<&serde_json::Value>) -> Vec<RawStatement> {
let text = |v: Option<&serde_json::Value>| v.and_then(|v| v.as_str()).map(str::to_string);
list.and_then(|v| v.as_array())
.into_iter()
.flatten()
.filter_map(|v| {
let analysis = v.get("analysis")?;
Some(RawStatement {
id: text(v.get("id"))?,
refs: v
.get("affects")
.and_then(|a| a.as_array())
.into_iter()
.flatten()
.filter_map(|a| text(a.get("ref")))
.collect(),
state: text(analysis.get("state"))?,
justification: text(analysis.get("justification")),
detail: non_blank(text(analysis.get("detail"))),
response: analysis
.get("response")
.and_then(|r| r.as_array())
.into_iter()
.flatten()
.filter_map(|r| text(Some(r)))
.collect(),
})
})
.collect()
}
/// A CycloneDX JSON `licenses` array as one licence: its expression, else
/// the ids or names, all of which apply.
fn cyclonedx_json_license(licenses: Option<&serde_json::Value>) -> Option<String> {
@@ -267,7 +446,7 @@ fn cyclonedx_json_license(licenses: Option<&serde_json::Value>) -> Option<String
/// A CycloneDX XML document's components. roxmltree refuses a DTD by
/// default, so no entity is ever expanded or fetched.
fn cyclonedx_xml(text: &str) -> Result<Vec<Component>, SuppliedSbomError> {
fn cyclonedx_xml(text: &str) -> Result<Doc, SuppliedSbomError> {
let doc = roxmltree::Document::parse(text).map_err(|e| SuppliedSbomError::Malformed {
format: "XML",
reason: e.to_string(),
@@ -283,11 +462,51 @@ fn cyclonedx_xml(text: &str) -> Result<Vec<Component>, SuppliedSbomError> {
" (an XML document, but not a CycloneDX BOM)".to_string(),
));
}
let mut out = Vec::new();
let mut components = Vec::new();
if let Some(list) = child(root, "components") {
cyclonedx_xml_components(list, &mut out)?;
cyclonedx_xml_components(list, &mut components)?;
}
Ok(out)
Ok(Doc {
components,
statements: child(root, "vulnerabilities")
.map(cyclonedx_xml_statements)
.unwrap_or_default(),
})
}
/// The supplier's statements of a CycloneDX XML `vulnerabilities` element,
/// as for JSON.
fn cyclonedx_xml_statements(list: roxmltree::Node<'_, '_>) -> Vec<RawStatement> {
elements(list, "vulnerability")
.filter_map(|v| {
let analysis = child(v, "analysis")?;
Some(RawStatement {
id: child_text(v, "id")?,
refs: child(v, "affects")
.into_iter()
.flat_map(|a| elements(a, "target"))
.filter_map(|t| child_text(t, "ref"))
.collect(),
state: child_text(analysis, "state")?,
justification: child_text(analysis, "justification"),
detail: non_blank(child_text(analysis, "detail")),
response: child(analysis, "responses")
.into_iter()
.flat_map(|r| elements(r, "response"))
.filter_map(|r| r.text().map(str::to_string))
.collect(),
})
})
.collect()
}
/// The child elements of `node` named `name`.
fn elements<'a, 'input>(
node: roxmltree::Node<'a, 'input>,
name: &'static str,
) -> impl Iterator<Item = roxmltree::Node<'a, 'input>> {
node.children()
.filter(move |n| n.is_element() && n.tag_name().name() == name)
}
/// The child element of `node` named `name`.
@@ -320,6 +539,7 @@ fn cyclonedx_xml_components(
if is_part(c.attribute("type")) {
if let Some(name) = child_text(c, "name").filter(|n| !n.trim().is_empty()) {
out.push(Component {
bom_ref: c.attribute("bom-ref").map(str::to_string),
group: child_text(c, "group"),
name,
version: child_text(c, "version"),
@@ -396,6 +616,7 @@ fn spdx2(doc: &serde_json::Value) -> Result<Vec<Component>, SuppliedSbomError> {
};
let name = text("name").filter(|n| !n.trim().is_empty())?;
Some(Component {
bom_ref: None,
group: None,
name,
version: text("versionInfo"),
@@ -515,6 +736,132 @@ mod tests {
assert!(product_entry(&supplier(Some(url), None), "t1").is_none());
}
const CDX_VEX_JSON: &str = r#"{
"bomFormat": "CycloneDX", "specVersion": "1.5",
"components": [
{"type": "library", "bom-ref": "lodash@4.17.20", "name": "lodash", "version": "4.17.20",
"purl": "pkg:npm/lodash@4.17.20"},
{"type": "library", "bom-ref": "blob", "name": "vendor-blob", "version": "2.0"}
],
"vulnerabilities": [
{"id": "CVE-2021-23337", "affects": [{"ref": "lodash@4.17.20"}],
"analysis": {"state": "not_affected", "justification": "code_not_reachable",
"detail": " template() is never called. ", "response": ["will_not_fix"]}},
{"id": "CVE-2026-1", "affects": [{"ref": "blob"}, {"ref": "nowhere"}],
"analysis": {"state": "exploitable", "response": ["update"]}},
{"id": "CVE-2026-2", "affects": [{"ref": "blob"}], "analysis": {"state": "unheard_of"}},
{"id": "CVE-2026-3", "affects": [{"ref": "blob"}]}
]
}"#;
#[test]
fn a_suppliers_cyclonedx_vex_is_read_per_component() {
use compliance_core::models::VexStatus;
let sbom = parse_with_statements(CDX_VEX_JSON.as_bytes(), "t1", "pump.cdx.json").unwrap();
assert_eq!(sbom.entries.len(), 2);
// Unknown states and statements without an analysis are left out,
// and so is a ref that names no component.
assert_eq!(sbom.statements.len(), 2, "{:?}", sbom.statements);
let lodash = &sbom.statements[0];
assert_eq!(lodash.vulnerability, "CVE-2021-23337");
assert_eq!(lodash.purl.as_deref(), Some("pkg:npm/lodash@4.17.20"));
assert_eq!(lodash.vex.status, VexStatus::NotAffected);
assert_eq!(
lodash.vex.justification.as_deref(),
Some("code_not_reachable")
);
assert_eq!(
lodash.vex.detail.as_deref(),
Some("template() is never called.")
);
assert_eq!(lodash.vex.response, ["will_not_fix"]);
assert_eq!(lodash.vex.source, "pump.cdx.json");
let blob = &sbom.statements[1];
assert_eq!(
(blob.name.as_str(), blob.version.as_str()),
("vendor-blob", "2.0")
);
assert_eq!(blob.vex.status, VexStatus::Affected);
}
#[test]
fn a_suppliers_cyclonedx_xml_vex_reads_as_its_json() {
let xml = r#"<?xml version="1.0"?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.5">
<components>
<component type="library" bom-ref="lodash@4.17.20"><name>lodash</name><version>4.17.20</version>
<purl>pkg:npm/lodash@4.17.20</purl></component>
</components>
<vulnerabilities>
<vulnerability><id>CVE-2021-23337</id>
<analysis><state>not_affected</state><justification>code_not_reachable</justification>
<detail>template() is never called.</detail>
<responses><response>will_not_fix</response></responses></analysis>
<affects><target><ref>lodash@4.17.20</ref></target></affects>
</vulnerability>
</vulnerabilities>
</bom>"#;
let from_xml = parse_with_statements(xml.as_bytes(), "t1", "pump.cdx.json").unwrap();
let from_json =
parse_with_statements(CDX_VEX_JSON.as_bytes(), "t1", "pump.cdx.json").unwrap();
assert_eq!(from_xml.statements, from_json.statements[..1]);
}
#[test]
fn a_statement_goes_to_the_alert_of_its_vulnerability_and_component() {
use compliance_core::models::CveSource;
let sbom = parse_with_statements(CDX_VEX_JSON.as_bytes(), "t1", "pump.cdx.json").unwrap();
let alert = |id: &str, package: &str, version: &str, purl: Option<&str>| {
let mut a = CveAlert::new(
id.into(),
"t1".into(),
package.into(),
version.into(),
CveSource::Osv,
);
a.purl = purl.map(String::from);
a
};
let mut by_alias = alert(
"GHSA-35jh-r3h4-6jhm",
"lodash",
"4.17.20",
Some("pkg:npm/lodash@4.17.20"),
);
by_alias.aliases = vec!["CVE-2021-23337".into()];
let mut stale = alert(
"CVE-2021-23337",
"lodash",
"4.17.21",
Some("pkg:npm/lodash@4.17.21"),
);
stale.supplier_vex = sbom.statements[0].vex.clone().into();
let mut alerts = vec![
by_alias,
alert("CVE-2026-1", "vendor-blob", "2.0", None),
stale,
];
attach(&sbom.statements, &mut alerts);
assert!(
alerts[0].supplier_vex.is_some(),
"matched by its alias and purl"
);
assert!(
alerts[1].supplier_vex.is_some(),
"matched by name and version"
);
assert!(
alerts[2].supplier_vex.is_none(),
"another version: the statement goes"
);
// It settles nothing: the alert's own status is unchanged.
assert!(alerts
.iter()
.all(|a| a.vex.is_none() && !a.is_resolved_by_vex()));
}
#[test]
fn an_xml_sbom_with_a_dtd_is_refused() {
let xml = r#"<?xml version="1.0"?>
@@ -128,11 +128,14 @@ pub async fn upsert_reported(db: &Database, alert: &CveAlert) -> Result<(), Agen
.update_one(other_component, doc! { "$unset": { "purl": "" } })
.await?;
}
// A supplier's statement (#1025) is restated by every scan; one the
// supplier no longer makes goes.
let mut unset = doc! { "resolved_at": "" };
if alert.supplier_vex.is_none() {
unset.insert("supplier_vex", "");
}
db.cve_alerts()
.update_one(
filter.clone(),
doc! { "$set": found, "$unset": { "resolved_at": "" } },
)
.update_one(filter.clone(), doc! { "$set": found, "$unset": unset })
.upsert(true)
.await?;
// The first scan that finds it actively exploited starts the CRA's
+48
View File
@@ -468,3 +468,51 @@ async fn not_affected_and_fixed_raise_no_notification_until_withdrawn() {
pool.drop_tenant(tenant).await.ok();
}
/// #1025: a supplier's statement is stored with the alert as the scan read
/// it, beside (never in) the alert's own VEX, and goes once a scan's SBOM no
/// longer states it.
#[tokio::test]
async fn a_suppliers_statement_is_restated_by_each_scan() {
let uri = std::env::var("TEST_MONGODB_URI")
.unwrap_or_else(|_| "mongodb://root:example@localhost:27017/?authSource=admin".into());
let prefix = format!(
"vexsup_{}",
&uuid::Uuid::new_v4().simple().to_string()[..10]
);
let Ok(pool) = DatabasePool::connect(&uri, &prefix).await else {
eprintln!("SKIP vex_lifecycle: no MongoDB reachable at {uri}");
return;
};
let tenant = "vex-supplier";
let Ok(db) = pool.for_tenant_id(tenant).await else {
eprintln!("SKIP vex_lifecycle: MongoDB at {uri} not usable");
return;
};
let mut stated = alert("CVE-7");
stated.supplier_vex = Some(compliance_core::models::SupplierVex {
status: VexStatus::NotAffected,
state: "not_affected".into(),
justification: Some("code_not_reachable".into()),
detail: None,
response: Vec::new(),
source: "pump.cdx.json".into(),
});
upsert_reported(&db, &stated).await.unwrap();
let first = stored(&db, "CVE-7").await;
assert_eq!(
first.supplier_vex.as_ref().map(|v| v.status),
Some(VexStatus::NotAffected)
);
assert!(
first.vex.is_none(),
"it is not the manufacturer's statement"
);
assert!(!first.is_resolved_by_vex(), "and settles nothing");
upsert_reported(&db, &alert("CVE-7")).await.unwrap();
assert!(stored(&db, "CVE-7").await.supplier_vex.is_none());
pool.drop_tenant(tenant).await.ok();
}
+1
View File
@@ -318,6 +318,7 @@ mod tests {
at: chrono::Utc::now(),
by_scan: false,
}),
supplier_vex: None,
resolved_at: None,
exploited_seen_at: None,
created_at: chrono::Utc::now(),
+7
View File
@@ -118,6 +118,12 @@ pub struct CveAlert {
/// The VEX statement on it (#498); none until someone states one.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub vex: Option<super::vex::VexAssessment>,
/// What the supplier of a bought-in component states about it in its SBOM
/// (#1025). Restated by every scan from the current SBOM, dropped when the
/// supplier no longer states it. Never the manufacturer's own statement:
/// it settles nothing and is not exported as one.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub supplier_vex: Option<super::vex::SupplierVex>,
/// When a complete scan last found it gone (the component removed or
/// past a fixed version); `None` while it is reported.
#[serde(
@@ -237,6 +243,7 @@ impl CveAlert {
exploitation: None,
advisories: Vec::new(),
vex: None,
supplier_vex: None,
resolved_at: None,
exploited_seen_at: None,
created_at: Utc::now(),
+1 -1
View File
@@ -91,7 +91,7 @@ pub use scan::{
RunErrorCode, RunNote, ScanPhase, ScanRun, ScanRunStatus, ScanStep, ScanType, SkipCode,
SkippedStage,
};
pub use vex::{VexAssessment, VexError, VexJustification, VexStatus};
pub use vex::{SupplierVex, VexAssessment, VexError, VexJustification, VexStatus};
pub use webhook_delivery::{DeliveryResult, WebhookDelivery, DELIVERIES_SHOWN};
pub use werkbank::{
CompleteRequest, CompleteResponse, DastCollect, Executor, HeartbeatAck, HeartbeatRequest,
+38
View File
@@ -94,6 +94,44 @@ pub struct VexAssessment {
pub by_scan: bool,
}
/// A supplier's VEX statement on a vulnerability of its component, as its
/// SBOM gives it (CycloneDX `vulnerabilities[].analysis`; #1025). Shown to
/// the person who decides, beside the manufacturer's own statement; it
/// settles nothing by itself.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct SupplierVex {
/// The status as OpenVEX names it, read from `state`.
pub status: VexStatus,
/// CycloneDX's `state` as the supplier wrote it (`not_affected`,
/// `resolved`, `exploitable`, `in_triage`, `false_positive`, …).
pub state: String,
/// CycloneDX's `justification` as the supplier wrote it.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub justification: Option<String>,
/// The supplier's explanation (`detail`).
#[serde(default, skip_serializing_if = "Option::is_none")]
pub detail: Option<String>,
/// What the supplier says to do (`response`: `update`, `workaround_available`, …).
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub response: Vec<String>,
/// The SBOM it was read from (its file name).
pub source: String,
}
impl SupplierVex {
/// The OpenVEX status of a CycloneDX analysis `state`; `None` for one
/// CycloneDX does not define.
pub fn status_of_state(state: &str) -> Option<VexStatus> {
Some(match state {
"resolved" | "resolved_with_pedigree" => VexStatus::Fixed,
"exploitable" => VexStatus::Affected,
"in_triage" => VexStatus::UnderInvestigation,
"not_affected" | "false_positive" => VexStatus::NotAffected,
_ => return None,
})
}
}
/// Why a VEX statement cannot be stored.
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
pub enum VexError {
+7
View File
@@ -123,6 +123,13 @@ go through the same CVE groups, VEX statements and ENISA drafts.
the supplier's name and version for it, and against its components by purl.
A matching advisory raises a CVE alert with the supplier's remediation and
fixed versions.
- **What the supplier states about a vulnerability:** a CycloneDX SBOM can
carry the supplier's VEX (`vulnerabilities[].analysis`: state,
justification, detail, response). Prüfwerk reads it for each component and
keeps it with the alert as the supplier's statement (`supplier_vex`). Every
scan reads it again from the current SBOM. It is shown to whoever decides,
but it is not your statement: it settles no alert, closes no issue and is
not exported as yours. Your own VEX status stays yours to state.
### When the SBOM is empty or incomplete