feat(vex): draft ENISA notifications of actively exploited vulnerabilities (CRA Art. 14) (#498, 4/4) #513
No files matched your search
@@ -9,6 +9,7 @@ use mongodb::bson::{doc, oid::ObjectId};
|
||||
use serde::Deserialize;
|
||||
|
||||
use compliance_core::csaf_docs;
|
||||
use compliance_core::enisa_docs::{self, EnisaInput, Reportability};
|
||||
use compliance_core::models::{CveAlert, SbomEntry, VexAssessment, VexJustification, VexStatus};
|
||||
use compliance_core::tenant_ctx::TenantCtx;
|
||||
use compliance_core::vex_docs::{self, VexInput};
|
||||
@@ -278,6 +279,139 @@ pub async fn export_csaf(
|
||||
download(&body, &filename)
|
||||
}
|
||||
|
||||
/// One alert in [`list_enisa`]: whether CRA Article 14 asks for it to be
|
||||
/// notified, and since when.
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct EnisaCandidate {
|
||||
pub alert_id: String,
|
||||
pub cve: String,
|
||||
pub component: String,
|
||||
pub reportable: bool,
|
||||
pub reason: &'static str,
|
||||
/// When a scan first found it actively exploited.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub exploited_seen_at: Option<chrono::DateTime<chrono::Utc>>,
|
||||
/// When the early warning is due (24 hours after that).
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub early_warning_due: Option<chrono::DateTime<chrono::Utc>>,
|
||||
}
|
||||
|
||||
/// GET /api/v1/targets/{id}/enisa — the target's actively exploited CVE
|
||||
/// alerts and whether each is to be notified under CRA Article 14 (#498).
|
||||
#[tracing::instrument(skip_all, fields(target_id = %id))]
|
||||
pub async fn list_enisa(
|
||||
Extension(agent): AgentExt,
|
||||
tenant: TenantCtx,
|
||||
Path(id): Path<String>,
|
||||
) -> ApiResult<Vec<EnisaCandidate>> {
|
||||
let db = tenant_db(&agent, &tenant).await?;
|
||||
let alerts: Vec<CveAlert> = match db.cve_alerts().find(doc! { "repo_id": &id }).await {
|
||||
Ok(cursor) => collect_cursor_async(cursor).await,
|
||||
Err(e) => {
|
||||
tracing::warn!("Failed to list CVE alerts: {e}");
|
||||
Vec::new()
|
||||
}
|
||||
};
|
||||
let candidates: Vec<EnisaCandidate> = alerts
|
||||
.iter()
|
||||
.filter_map(|a| {
|
||||
let reportability = enisa_docs::reportability(a);
|
||||
(reportability != Reportability::NotExploited).then(|| EnisaCandidate {
|
||||
alert_id: a.id.map(|o| o.to_hex()).unwrap_or_default(),
|
||||
cve: a.cve().to_string(),
|
||||
component: format!("{} {}", a.affected_package, a.affected_version),
|
||||
reportable: reportability == Reportability::Reportable,
|
||||
reason: reportability.reason(),
|
||||
exploited_seen_at: a.exploited_seen_at,
|
||||
early_warning_due: a
|
||||
.exploited_seen_at
|
||||
.map(|at| at + chrono::Duration::hours(24)),
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
Ok(Json(ApiResponse {
|
||||
total: Some(candidates.len() as u64),
|
||||
data: candidates,
|
||||
page: None,
|
||||
}))
|
||||
}
|
||||
|
||||
/// The query of [`export_enisa`].
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct EnisaExportQuery {
|
||||
/// When the manufacturer became aware (RFC 3339); without it, when a
|
||||
/// scan first found the alert actively exploited.
|
||||
#[serde(default)]
|
||||
pub aware_at: Option<String>,
|
||||
}
|
||||
|
||||
/// GET /api/v1/cves/{id}/enisa?aware_at=<RFC 3339> — the draft CRA Article 14
|
||||
/// notification (early warning, vulnerability notification, final report)
|
||||
/// of an alert, in the fields of ENISA's single reporting platform. Always
|
||||
/// a draft; Prüfwerk submits nothing. 422 with the reason for an alert that
|
||||
/// is not to be notified, 400 for an unreadable `aware_at`.
|
||||
#[tracing::instrument(skip_all, fields(alert_id = %id))]
|
||||
pub async fn export_enisa(
|
||||
Extension(agent): AgentExt,
|
||||
tenant: TenantCtx,
|
||||
Path(id): Path<String>,
|
||||
Query(query): Query<EnisaExportQuery>,
|
||||
) -> Result<axum::response::Response, StatusCode> {
|
||||
let oid = ObjectId::parse_str(&id).map_err(|_| StatusCode::BAD_REQUEST)?;
|
||||
let aware_at = match query
|
||||
.aware_at
|
||||
.as_deref()
|
||||
.map(str::trim)
|
||||
.filter(|t| !t.is_empty())
|
||||
{
|
||||
Some(text) => Some(
|
||||
chrono::DateTime::parse_from_rfc3339(text)
|
||||
.map_err(|_| StatusCode::BAD_REQUEST)?
|
||||
.with_timezone(&chrono::Utc),
|
||||
),
|
||||
None => None,
|
||||
};
|
||||
let db = tenant_db(&agent, &tenant).await?;
|
||||
let alert = db
|
||||
.cve_alerts()
|
||||
.find_one(doc! { "_id": oid })
|
||||
.await
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?
|
||||
.ok_or(StatusCode::NOT_FOUND)?;
|
||||
let reportability = enisa_docs::reportability(&alert);
|
||||
if reportability != Reportability::Reportable {
|
||||
let body = Json(serde_json::json!({ "error": reportability.reason() }));
|
||||
return Ok((StatusCode::UNPROCESSABLE_ENTITY, body).into_response());
|
||||
}
|
||||
let product = match ObjectId::parse_str(&alert.repo_id) {
|
||||
Ok(target) => db
|
||||
.onboarded_targets()
|
||||
.find_one(doc! { "_id": target })
|
||||
.await
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?
|
||||
.map(|t| t.name),
|
||||
Err(_) => None,
|
||||
}
|
||||
.unwrap_or_else(|| alert.repo_id.clone());
|
||||
let now = chrono::Utc::now();
|
||||
let manufacturer = author(&tenant);
|
||||
let tooling = format!("Prüfwerk {}", super::platform::BUILD_VERSION);
|
||||
let body = enisa_docs::draft(&EnisaInput {
|
||||
product: &product,
|
||||
manufacturer: &manufacturer,
|
||||
tooling: &tooling,
|
||||
alert: &alert,
|
||||
aware_at: aware_at.or(alert.exploited_seen_at).unwrap_or(now),
|
||||
now,
|
||||
});
|
||||
let filename = format!(
|
||||
"enisa-draft-{}-{}.json",
|
||||
alert.cve().to_ascii_lowercase(),
|
||||
now.format("%Y%m%d")
|
||||
);
|
||||
download(&body, &filename).map(IntoResponse::into_response)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -105,6 +105,8 @@ pub fn build_router() -> Router {
|
||||
)
|
||||
.route("/api/v1/targets/{id}/vex", get(handlers::vex::export_vex))
|
||||
.route("/api/v1/targets/{id}/csaf", get(handlers::vex::export_csaf))
|
||||
.route("/api/v1/targets/{id}/enisa", get(handlers::vex::list_enisa))
|
||||
.route("/api/v1/cves/{id}/enisa", get(handlers::vex::export_enisa))
|
||||
.route("/api/v1/cves/{id}/vex", patch(handlers::vex::set_cve_vex))
|
||||
.route(
|
||||
"/api/v1/targets/{id}/evidence-pack",
|
||||
|
||||
@@ -17,7 +17,7 @@ use sha2::{Digest, Sha256};
|
||||
|
||||
use compliance_core::models::oscal_assessment::assess;
|
||||
use compliance_core::models::{CveAlert, Finding, OnboardedTarget, SbomEntry, ScanRun, SkipCode};
|
||||
use compliance_core::{csaf_docs, sbom_docs, vex_docs};
|
||||
use compliance_core::{csaf_docs, enisa_docs, sbom_docs, vex_docs};
|
||||
|
||||
use crate::error::AgentError;
|
||||
|
||||
@@ -113,6 +113,26 @@ pub fn build_pack(
|
||||
),
|
||||
("cra-compliance.json", json(&compliance_of(inputs))?),
|
||||
];
|
||||
// Draft CRA Article 14 notifications of the actively exploited
|
||||
// vulnerabilities in the product (#498), when there are any.
|
||||
let enisa: Vec<serde_json::Value> = inputs
|
||||
.cves
|
||||
.iter()
|
||||
.filter(|a| enisa_docs::reportability(a) == enisa_docs::Reportability::Reportable)
|
||||
.map(|alert| {
|
||||
enisa_docs::draft(&enisa_docs::EnisaInput {
|
||||
product: subject,
|
||||
manufacturer: vex.author,
|
||||
tooling: &tooling,
|
||||
alert,
|
||||
aware_at: alert.exploited_seen_at.unwrap_or(at),
|
||||
now: at,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
if !enisa.is_empty() {
|
||||
files.push(("enisa-drafts.json", json(&enisa)?));
|
||||
}
|
||||
// The SBOM's quality score of the last scan (sbomqs, #496), when it was
|
||||
// scored.
|
||||
if let Some(quality) = sbom_quality(inputs) {
|
||||
@@ -347,6 +367,30 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_actively_exploited_vulnerability_adds_its_draft_notification() {
|
||||
let mut with_kev = inputs();
|
||||
let mut alert = compliance_core::models::CveAlert::new(
|
||||
"CVE-2021-44228".into(),
|
||||
"t1".into(),
|
||||
"log4j-core".into(),
|
||||
"2.14.1".into(),
|
||||
compliance_core::models::CveSource::Osv,
|
||||
);
|
||||
alert.exploitation = Some(compliance_core::models::Exploitation {
|
||||
kev: Some(compliance_core::models::KevEntry {
|
||||
date_added: "2021-12-10".into(),
|
||||
known_ransomware: false,
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
with_kev.cves = vec![alert];
|
||||
let (_, listed) = build_pack(&with_kev, Utc::now()).expect("pack");
|
||||
assert!(listed.iter().any(|f| f.name == "enisa-drafts.json"));
|
||||
let (_, listed) = build_pack(&inputs(), Utc::now()).expect("pack");
|
||||
assert!(listed.iter().all(|f| f.name != "enisa-drafts.json"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_pack_holds_every_file_and_the_manifest_hashes_match() {
|
||||
let (zip_bytes, listed) = build_pack(&inputs(), Utc::now()).expect("pack");
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
//! complete lookup no longer reports it (the component removed or updated
|
||||
//! past the fix), it is marked resolved, and one nobody assessed, or
|
||||
//! assessed as affected, gets the VEX status `fixed` from the scan. A
|
||||
//! person's `not_affected` or `fixed` is never changed by a scan.
|
||||
//! person's `not_affected` or `fixed` is never changed by a scan. The first
|
||||
//! scan that finds it actively exploited records when (`exploited_seen_at`),
|
||||
//! the start of the CRA's reporting deadlines.
|
||||
|
||||
use mongodb::bson::doc;
|
||||
|
||||
@@ -32,6 +34,22 @@ pub async fn upsert_reported(db: &Database, alert: &CveAlert) -> Result<(), Agen
|
||||
)
|
||||
.upsert(true)
|
||||
.await?;
|
||||
// The first scan that finds it actively exploited starts the CRA's
|
||||
// reporting clock (Article 14(2)); later scans keep that time.
|
||||
if alert
|
||||
.exploitation
|
||||
.as_ref()
|
||||
.is_some_and(|e| e.actively_exploited())
|
||||
{
|
||||
let mut unseen = filter.clone();
|
||||
unseen.insert("exploited_seen_at", doc! { "$exists": false });
|
||||
db.cve_alerts()
|
||||
.update_one(
|
||||
unseen,
|
||||
doc! { "$set": { "exploited_seen_at": mongodb::bson::DateTime::now() } },
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
let mut scan_fixed = filter;
|
||||
scan_fixed.insert("vex.by_scan", true);
|
||||
scan_fixed.insert("vex.status", "fixed");
|
||||
|
||||
@@ -122,5 +122,22 @@ async fn vex_status_follows_the_scans_but_never_overrides_a_person() {
|
||||
assert!(two.resolved_at.is_none());
|
||||
assert_eq!(two.vex.map(|v| v.status), Some(VexStatus::NotAffected));
|
||||
|
||||
// The first scan that finds it actively exploited starts the reporting
|
||||
// clock; a later scan keeps that time.
|
||||
let mut exploited = alert("CVE-5");
|
||||
exploited.exploitation = Some(compliance_core::models::Exploitation {
|
||||
kev: Some(compliance_core::models::KevEntry {
|
||||
date_added: "2021-12-10".into(),
|
||||
known_ransomware: false,
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
upsert_reported(&db, &alert("CVE-5")).await.unwrap();
|
||||
assert!(stored(&db, "CVE-5").await.exploited_seen_at.is_none());
|
||||
upsert_reported(&db, &exploited).await.unwrap();
|
||||
let first = stored(&db, "CVE-5").await.exploited_seen_at.unwrap();
|
||||
upsert_reported(&db, &exploited).await.unwrap();
|
||||
assert_eq!(stored(&db, "CVE-5").await.exploited_seen_at, Some(first));
|
||||
|
||||
pool.drop_tenant(tenant).await.ok();
|
||||
}
|
||||
@@ -0,0 +1,566 @@
|
||||
//! Draft notifications of an actively exploited vulnerability under the
|
||||
//! Cyber Resilience Act (Regulation (EU) 2024/2847), Article 14(1) and (2)
|
||||
//! (#498): the early warning (24 hours), the vulnerability notification (72
|
||||
//! hours) and the final report (14 days after a corrective measure is
|
||||
//! available), for the manufacturer to check, complete and enter by hand in
|
||||
//! ENISA's single reporting platform (SRP, Article 16). Prüfwerk submits
|
||||
//! nothing.
|
||||
//!
|
||||
//! The fields are the SRP's, as ENISA's CRA SRP Glossary ([`GLOSSARY`])
|
||||
//! defines them: their numbers and names, and per stage whether each is
|
||||
//! required, optional or copied from the previous stage. Each carries the
|
||||
//! point of Article 14 it serves. Prüfwerk fills what it knows (the product
|
||||
//! and component, the advisory, its exploitation, the VEX statement); a
|
||||
//! required field it cannot fill is listed under `to_complete`. The Member
|
||||
//! States are always the manufacturer's to enter.
|
||||
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
|
||||
use crate::models::{CveAlert, VexStatus};
|
||||
use crate::vex_docs::{rfc3339, status_of};
|
||||
|
||||
/// The stamp every draft carries.
|
||||
pub const DRAFT_STAMP: &str = "Draft, not submitted";
|
||||
|
||||
/// The glossary the fields follow. When ENISA publishes a new version,
|
||||
/// compare its table with [`FIELDS`] and update both.
|
||||
pub const GLOSSARY: Glossary = Glossary {
|
||||
name: "ENISA CRA SRP Glossary",
|
||||
version: "1.4",
|
||||
last_update: "2026-10-01",
|
||||
url: "https://www.enisa.europa.eu/cra-srp-glossary",
|
||||
};
|
||||
|
||||
/// Which glossary version the drafts follow.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
|
||||
pub struct Glossary {
|
||||
pub name: &'static str,
|
||||
pub version: &'static str,
|
||||
pub last_update: &'static str,
|
||||
pub url: &'static str,
|
||||
}
|
||||
|
||||
/// Where the notifications go (Article 14(7), Article 16(1)).
|
||||
const SUBMIT_VIA: &str = "ENISA's CRA single reporting platform \
|
||||
(https://portal.cra-srp.enisa.europa.eu), through the electronic notification end-point \
|
||||
of the CSIRT designated as coordinator of the Member State where the manufacturer has its \
|
||||
main establishment in the Union (Article 14(7)); simultaneously accessible to ENISA";
|
||||
|
||||
/// A field's requirement at one stage, as the glossary states it.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
enum Need {
|
||||
Required,
|
||||
/// Required if such information is available.
|
||||
IfAvailable,
|
||||
Optional,
|
||||
/// By default copied from the previous stage, or updated.
|
||||
Copied,
|
||||
/// Not part of this stage.
|
||||
No,
|
||||
}
|
||||
|
||||
impl Need {
|
||||
fn text(self) -> &'static str {
|
||||
match self {
|
||||
Self::Required => "Required",
|
||||
Self::IfAvailable => "Required if such information available",
|
||||
Self::Optional => "Optional",
|
||||
Self::Copied => "By default copied from previous step, or updated",
|
||||
Self::No => "N/A",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// One SRP field for actively exploited vulnerabilities.
|
||||
struct Field {
|
||||
/// The glossary's number (`5`, `v26a`).
|
||||
nr: &'static str,
|
||||
/// The glossary's name.
|
||||
name: &'static str,
|
||||
/// The requirement at the early warning, the 72-hour notification and
|
||||
/// the final report.
|
||||
stages: [Need; 3],
|
||||
/// The point of Regulation (EU) 2024/2847 it serves.
|
||||
cra_art14_ref: &'static str,
|
||||
}
|
||||
|
||||
use Need::{Copied, IfAvailable, No, Optional, Required};
|
||||
|
||||
/// The fields of the glossary that apply to an actively exploited
|
||||
/// vulnerability (the common and the AEV fields; not the incident fields,
|
||||
/// nor the CSIRT's own note), in its order.
|
||||
const FIELDS: &[Field] = &[
|
||||
Field { nr: "1", name: "Notification type (Vulnerability/Incident)", stages: [Required, Copied, Copied], cra_art14_ref: "Art. 14(1)" },
|
||||
Field { nr: "2", name: "Title", stages: [Required, Copied, Copied], cra_art14_ref: "Art. 14(2)" },
|
||||
Field { nr: "3", name: "Summary", stages: [Required, Copied, Copied], cra_art14_ref: "Art. 14(2)" },
|
||||
Field { nr: "4", name: "Manufacturer name", stages: [Required, Copied, Copied], cra_art14_ref: "Art. 14(1)" },
|
||||
Field { nr: "5", name: "Member States where product available (Concerned CSIRT)", stages: [Required, Copied, Copied], cra_art14_ref: "Art. 14(2)(a)" },
|
||||
Field { nr: "6", name: "Product Name", stages: [Required, Copied, Copied], cra_art14_ref: "Art. 14(2)(b): general information about the product" },
|
||||
Field { nr: "7", name: "Product Version", stages: [Required, Copied, Copied], cra_art14_ref: "Art. 14(2)(b): general information about the product" },
|
||||
Field { nr: "8", name: "Product Type (Default/Important Product with Digital Elements/Critical Product with Digital Elements)", stages: [Optional, Copied, Copied], cra_art14_ref: "Art. 14(2)(b): general information about the product" },
|
||||
Field { nr: "9", name: "Product class", stages: [Optional, Copied, Copied], cra_art14_ref: "Art. 14(2)(b): general information about the product" },
|
||||
Field { nr: "10", name: "Product category", stages: [Optional, Copied, Copied], cra_art14_ref: "Art. 14(2)(b): general information about the product" },
|
||||
Field { nr: "11", name: "End of support indicator", stages: [Optional, Copied, Copied], cra_art14_ref: "Art. 14(2)(b): general information about the product" },
|
||||
Field { nr: "12", name: "Component name", stages: [Optional, Copied, Copied], cra_art14_ref: "Art. 14(2)(b): general information about the product" },
|
||||
Field { nr: "13", name: "Mitigating measure expected shortly", stages: [Optional, Copied, Copied], cra_art14_ref: "Art. 14(2)(b): corrective or mitigating measures" },
|
||||
Field { nr: "14", name: "User Action able to reduce impact", stages: [Optional, Copied, Copied], cra_art14_ref: "Art. 14(2)(b): measures users can take" },
|
||||
Field { nr: "15", name: "Considered sensitivity of information", stages: [Optional, Optional, Copied], cra_art14_ref: "Art. 14(2)(b): how sensitive the information is" },
|
||||
Field { nr: "16", name: "Corrective or mitigating measures taken", stages: [Optional, Optional, Required], cra_art14_ref: "Art. 14(2)(b): corrective or mitigating measures taken" },
|
||||
Field { nr: "17", name: "Corrective or mitigating measures that users can take", stages: [Optional, Optional, Required], cra_art14_ref: "Art. 14(2)(b): measures users can take" },
|
||||
Field { nr: "18", name: "Attack vector", stages: [No, Optional, Optional], cra_art14_ref: "Art. 14(2)(b): general nature of the exploit" },
|
||||
Field { nr: "v19", name: "CVE ID", stages: [Optional, Copied, Copied], cra_art14_ref: "Art. 14(2)" },
|
||||
Field { nr: "v20", name: "EUVD ID", stages: [Optional, Copied, Copied], cra_art14_ref: "Art. 14(2)" },
|
||||
Field { nr: "v21", name: "General information", stages: [Optional, Required, Copied], cra_art14_ref: "Art. 14(2)(b): general nature of the exploit and of the vulnerability" },
|
||||
Field { nr: "v22", name: "Date when corrective or mitigating measure has been available", stages: [Optional, Optional, Required], cra_art14_ref: "Art. 14(2)(c): 14 days after a corrective or mitigating measure is available" },
|
||||
Field { nr: "v23", name: "Details about the security update/corrective measure available", stages: [Optional, Optional, Required], cra_art14_ref: "Art. 14(2)(c)(iii)" },
|
||||
Field { nr: "v24", name: "Full description of the Severity of the vulnerability", stages: [Optional, Optional, Required], cra_art14_ref: "Art. 14(2)(c)(i)" },
|
||||
Field { nr: "v25", name: "Full description of the Impact of the vulnerability", stages: [Optional, Optional, Required], cra_art14_ref: "Art. 14(2)(c)(i)" },
|
||||
Field { nr: "v26", name: "Date and time when you become aware of the Actively Exploited Vulnerability", stages: [Required, Copied, Copied], cra_art14_ref: "Art. 14(2)(a): 24 hours of the manufacturer becoming aware" },
|
||||
Field { nr: "v26a", name: "Date and time when the Actively Exploited Vulnerability occurred (UTC time)", stages: [Optional, Required, Copied], cra_art14_ref: "Art. 14(2)(b)" },
|
||||
Field { nr: "v27", name: "Malicious actor that has exploited/is exploiting the vulnerability", stages: [Optional, Optional, IfAvailable], cra_art14_ref: "Art. 14(2)(c)(ii)" },
|
||||
Field { nr: "v28", name: "Particular Exceptional Circumstances (PEC)", stages: [No, Optional, No], cra_art14_ref: "Art. 16(2), third subparagraph" },
|
||||
Field { nr: "v29", name: "PEC Delay Reason", stages: [No, Optional, No], cra_art14_ref: "Art. 16(2), third subparagraph" },
|
||||
Field { nr: "v30", name: "Please provide further information", stages: [Optional, Optional, Copied], cra_art14_ref: "Art. 16(2)" },
|
||||
Field { nr: "40", name: "AR Note", stages: [Optional, Optional, Optional], cra_art14_ref: "Art. 14(7)" },
|
||||
];
|
||||
|
||||
/// The stages, with their deadline as Article 14(2) sets it.
|
||||
const STAGES: [(&str, &str); 3] = [
|
||||
("early_warning", "Art. 14(2)(a): within 24 hours of becoming aware"),
|
||||
("vulnerability_notification", "Art. 14(2)(b): within 72 hours of becoming aware"),
|
||||
("final_report", "Art. 14(2)(c): no later than 14 days after a corrective or mitigating measure is available"),
|
||||
];
|
||||
|
||||
/// Whether an alert is to be notified under Article 14(1).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Reportability {
|
||||
/// Actively exploited, and the product affected or under investigation,
|
||||
/// or fixed after the exploitation was known (the final report is due
|
||||
/// 14 days after the fix).
|
||||
Reportable,
|
||||
/// No source says it is actively exploited.
|
||||
NotExploited,
|
||||
/// The manufacturer stated the product is not affected.
|
||||
NotAffected,
|
||||
/// The product no longer contains the vulnerable component or version,
|
||||
/// and no scan found it exploited while it did.
|
||||
Fixed,
|
||||
}
|
||||
|
||||
impl Reportability {
|
||||
/// Why an alert is (not) to be notified, in words.
|
||||
pub const fn reason(self) -> &'static str {
|
||||
match self {
|
||||
Self::Reportable => {
|
||||
"actively exploited while the product is or was affected (Article 14(1))"
|
||||
}
|
||||
Self::NotExploited => "not known to be actively exploited",
|
||||
Self::NotAffected => "the product is not affected (VEX not_affected)",
|
||||
Self::Fixed => {
|
||||
"the product no longer contains the vulnerable component (VEX fixed), and no \
|
||||
scan found it exploited before"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether `alert` is to be notified: actively exploited (CISA KEV, or SSVC
|
||||
/// exploitation `active`) and not stated `not_affected`. A `fixed` one
|
||||
/// stays reportable when a scan found it exploited while the product still
|
||||
/// contained it: fixing the product does not discharge the notification,
|
||||
/// and the final report is due 14 days after the fix.
|
||||
pub fn reportability(alert: &CveAlert) -> Reportability {
|
||||
let exploited = alert
|
||||
.exploitation
|
||||
.as_ref()
|
||||
.is_some_and(|e| e.actively_exploited());
|
||||
match (exploited, status_of(alert)) {
|
||||
(false, _) => Reportability::NotExploited,
|
||||
(true, VexStatus::NotAffected) => Reportability::NotAffected,
|
||||
(true, VexStatus::Fixed) if alert.exploited_seen_at.is_none() => Reportability::Fixed,
|
||||
(true, VexStatus::Affected | VexStatus::UnderInvestigation | VexStatus::Fixed) => {
|
||||
Reportability::Reportable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// When the fix became available, as far as Prüfwerk knows: when a person
|
||||
/// stated `fixed`, else when a scan found the component gone.
|
||||
fn fixed_at(alert: &CveAlert) -> Option<DateTime<Utc>> {
|
||||
if status_of(alert) != VexStatus::Fixed {
|
||||
return None;
|
||||
}
|
||||
alert
|
||||
.vex
|
||||
.as_ref()
|
||||
.filter(|v| v.status == VexStatus::Fixed && !v.by_scan)
|
||||
.map(|v| v.at)
|
||||
.or(alert.resolved_at)
|
||||
}
|
||||
|
||||
/// What a draft is built from.
|
||||
pub struct EnisaInput<'a> {
|
||||
/// The product: the target's name.
|
||||
pub product: &'a str,
|
||||
/// The manufacturer: the workspace's name.
|
||||
pub manufacturer: &'a str,
|
||||
/// The tool and version that wrote it (`Prüfwerk 0.4.5`).
|
||||
pub tooling: &'a str,
|
||||
pub alert: &'a CveAlert,
|
||||
/// When the manufacturer became aware of the exploitation; the
|
||||
/// deadlines run from here.
|
||||
pub aware_at: DateTime<Utc>,
|
||||
pub now: DateTime<Utc>,
|
||||
}
|
||||
|
||||
/// What users can do: the VEX action statement, else the fixed version.
|
||||
fn user_measures(alert: &CveAlert) -> Option<String> {
|
||||
alert
|
||||
.vex
|
||||
.as_ref()
|
||||
.and_then(|v| v.action_statement.clone())
|
||||
.or_else(|| {
|
||||
(!alert.fixed_versions.is_empty()).then(|| {
|
||||
format!(
|
||||
"Update {} to {}.",
|
||||
alert.affected_package,
|
||||
alert.fixed_versions.join(" or ")
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// What is known about the exploitation, in words.
|
||||
fn exploitation_text(alert: &CveAlert) -> Option<String> {
|
||||
let e = alert.exploitation.as_ref()?;
|
||||
let mut parts = Vec::new();
|
||||
if let Some(kev) = &e.kev {
|
||||
parts.push(format!(
|
||||
"Listed in CISA's Known Exploited Vulnerabilities catalog since {}.",
|
||||
kev.date_added
|
||||
));
|
||||
}
|
||||
if let Some(ssvc) = &e.ssvc_exploitation {
|
||||
parts.push(format!("SSVC exploitation (CISA Vulnrichment): {ssvc}."));
|
||||
}
|
||||
if let Some(epss) = &e.epss {
|
||||
parts.push(format!(
|
||||
"EPSS (FIRST): {:.1} % probability of exploitation in the next 30 days.",
|
||||
epss.score * 100.0
|
||||
));
|
||||
}
|
||||
(!parts.is_empty()).then(|| parts.join(" "))
|
||||
}
|
||||
|
||||
/// The value Prüfwerk can give field `nr`, if any.
|
||||
fn value(nr: &str, input: &EnisaInput<'_>) -> Option<serde_json::Value> {
|
||||
let alert = input.alert;
|
||||
let cve = alert.cve();
|
||||
let text = |s: String| Some(serde_json::Value::String(s));
|
||||
match nr {
|
||||
"1" => text("Vulnerability".into()),
|
||||
"2" => text(format!(
|
||||
"Active exploitation of {cve} affecting {}",
|
||||
input.product
|
||||
)),
|
||||
"3" => {
|
||||
let fix = match user_measures(alert) {
|
||||
Some(m) => format!(" Users can act: {m}"),
|
||||
None => String::new(),
|
||||
};
|
||||
text(format!(
|
||||
"An actively exploited vulnerability ({cve}) in the component {} {} affects {}.{fix}",
|
||||
alert.affected_package, alert.affected_version, input.product
|
||||
))
|
||||
}
|
||||
"4" => text(input.manufacturer.to_string()),
|
||||
"6" => text(input.product.to_string()),
|
||||
"12" => text(format!(
|
||||
"{} {}",
|
||||
alert.affected_package, alert.affected_version
|
||||
)),
|
||||
"14" | "17" => user_measures(alert).and_then(text),
|
||||
"16" => alert
|
||||
.vex
|
||||
.as_ref()
|
||||
.and_then(|v| v.action_statement.clone())
|
||||
.and_then(text),
|
||||
"v19" => cve.starts_with("CVE-").then(|| serde_json::json!(cve)),
|
||||
"v21" => {
|
||||
let parts: Vec<String> = [alert.summary.clone(), exploitation_text(alert)]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect();
|
||||
(!parts.is_empty()).then(|| serde_json::json!(parts.join(" ")))
|
||||
}
|
||||
"v22" => fixed_at(alert).map(|at| serde_json::json!(rfc3339(at))),
|
||||
"v23" => (!alert.fixed_versions.is_empty()).then(|| {
|
||||
serde_json::json!(format!(
|
||||
"Fixed in {} {}.",
|
||||
alert.affected_package,
|
||||
alert.fixed_versions.join(", ")
|
||||
))
|
||||
}),
|
||||
"v24" => {
|
||||
let severity = alert.severity.as_deref()?;
|
||||
text(match alert.cvss_score {
|
||||
Some(score) => format!("Severity {severity} (CVSS base score {score:.1})."),
|
||||
None => format!("Severity {severity}."),
|
||||
})
|
||||
}
|
||||
"v25" => alert
|
||||
.vex
|
||||
.as_ref()
|
||||
.and_then(|v| v.impact_statement.clone())
|
||||
.or_else(|| alert.llm_impact_summary.clone())
|
||||
.and_then(text),
|
||||
"v26" => text(rfc3339(input.aware_at)),
|
||||
"v27" => alert
|
||||
.exploitation
|
||||
.as_ref()
|
||||
.and_then(|e| e.kev.as_ref())
|
||||
.filter(|k| k.known_ransomware)
|
||||
.map(|_| {
|
||||
serde_json::json!(
|
||||
"CISA's Known Exploited Vulnerabilities catalog lists known use in \
|
||||
ransomware campaigns."
|
||||
)
|
||||
}),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The draft notification package of `input.alert`.
|
||||
pub fn draft(input: &EnisaInput<'_>) -> serde_json::Value {
|
||||
let mut stages = serde_json::Map::new();
|
||||
let mut to_complete: Vec<String> = Vec::new();
|
||||
for (i, (stage, deadline)) in STAGES.iter().enumerate() {
|
||||
let fields: Vec<serde_json::Value> = FIELDS
|
||||
.iter()
|
||||
.filter(|f| f.stages[i] != Need::No)
|
||||
.map(|f| {
|
||||
let value = value(f.nr, input);
|
||||
let need = f.stages[i];
|
||||
// The Member States are always the manufacturer's to enter.
|
||||
if value.is_none() && need == Need::Required {
|
||||
to_complete.push(format!("{stage}: {}. {}", f.nr, f.name));
|
||||
}
|
||||
serde_json::json!({
|
||||
"nr": f.nr,
|
||||
"field": f.name,
|
||||
"requirement": need.text(),
|
||||
"value": value,
|
||||
"cra_art14_ref": f.cra_art14_ref,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
stages.insert(
|
||||
(*stage).to_string(),
|
||||
serde_json::json!({ "deadline": deadline, "fields": fields }),
|
||||
);
|
||||
}
|
||||
serde_json::json!({
|
||||
"status": DRAFT_STAMP,
|
||||
"submitted": false,
|
||||
"legal_basis": "Regulation (EU) 2024/2847 (Cyber Resilience Act), Article 14(1) and (2)",
|
||||
"glossary": GLOSSARY,
|
||||
"submit_via": SUBMIT_VIA,
|
||||
"generated_at": rfc3339(input.now),
|
||||
"generator": input.tooling,
|
||||
"aware_at": rfc3339(input.aware_at),
|
||||
"due": {
|
||||
"early_warning": rfc3339(input.aware_at + Duration::hours(24)),
|
||||
"vulnerability_notification": rfc3339(input.aware_at + Duration::hours(72)),
|
||||
"final_report": fixed_at(input.alert)
|
||||
.map(|at| rfc3339(at + Duration::days(14)))
|
||||
.unwrap_or_else(|| "14 days after the date in field v22".to_string()),
|
||||
},
|
||||
"stages": stages,
|
||||
"to_complete": to_complete,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::models::{CveSource, Exploitation, KevEntry, VexAssessment};
|
||||
|
||||
fn alert() -> CveAlert {
|
||||
let mut a = CveAlert::new(
|
||||
"GHSA-jfh8-c2jp-5v3q".into(),
|
||||
"t".into(),
|
||||
"log4j-core".into(),
|
||||
"2.14.1".into(),
|
||||
CveSource::Osv,
|
||||
);
|
||||
a.aliases = vec!["CVE-2021-44228".into()];
|
||||
a.summary = Some("Remote code injection in Log4j".into());
|
||||
a.severity = Some("CRITICAL".into());
|
||||
a.cvss_score = Some(10.0);
|
||||
a.fixed_versions = vec!["2.17.1".into()];
|
||||
a.exploitation = Some(Exploitation {
|
||||
kev: Some(KevEntry {
|
||||
date_added: "2021-12-10".into(),
|
||||
known_ransomware: true,
|
||||
}),
|
||||
..Exploitation::default()
|
||||
});
|
||||
a
|
||||
}
|
||||
|
||||
fn at(text: &str) -> DateTime<Utc> {
|
||||
DateTime::parse_from_rfc3339(text)
|
||||
.map(|d| d.with_timezone(&Utc))
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn statement(status: VexStatus) -> VexAssessment {
|
||||
VexAssessment {
|
||||
status,
|
||||
justification: None,
|
||||
impact_statement: Some("JNDI lookups are disabled.".into()),
|
||||
action_statement: None,
|
||||
by: "u1".into(),
|
||||
by_name: None,
|
||||
at: Utc::now(),
|
||||
by_scan: false,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_exploited_vulnerabilities_in_the_product_are_reported() {
|
||||
let mut a = alert();
|
||||
assert_eq!(reportability(&a), Reportability::Reportable);
|
||||
a.vex = Some(statement(VexStatus::NotAffected));
|
||||
assert_eq!(reportability(&a), Reportability::NotAffected);
|
||||
a.vex = None;
|
||||
a.resolved_at = Some(Utc::now());
|
||||
assert_eq!(reportability(&a), Reportability::Fixed);
|
||||
// Found exploited while the product contained it: the final report
|
||||
// is still due.
|
||||
a.exploited_seen_at = Some(at("2026-10-06T08:00:00Z"));
|
||||
assert_eq!(reportability(&a), Reportability::Reportable);
|
||||
a.exploitation = None;
|
||||
assert_eq!(reportability(&a), Reportability::NotExploited);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_fixed_vulnerability_dates_its_final_report() {
|
||||
let mut a = alert();
|
||||
a.exploited_seen_at = Some(at("2026-10-01T08:00:00Z"));
|
||||
a.resolved_at = Some(at("2026-10-05T10:00:00Z"));
|
||||
let doc = draft(&EnisaInput {
|
||||
product: "Pump Remote",
|
||||
manufacturer: "example-pumps",
|
||||
tooling: "Prüfwerk test",
|
||||
alert: &a,
|
||||
aware_at: at("2026-10-01T08:00:00Z"),
|
||||
now: at("2026-10-06T09:00:00Z"),
|
||||
});
|
||||
assert_eq!(doc["due"]["final_report"], "2026-10-19T10:00:00Z");
|
||||
let v22 = doc["stages"]["final_report"]["fields"]
|
||||
.as_array()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.find(|f| f["nr"] == "v22")
|
||||
.cloned()
|
||||
.unwrap_or_default();
|
||||
assert_eq!(v22["value"], "2026-10-05T10:00:00Z");
|
||||
assert!(doc["to_complete"]
|
||||
.as_array()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.all(|t| !t.as_str().unwrap_or_default().contains("v22")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_glossary_fields_are_complete_and_unique() {
|
||||
let mut nrs: Vec<&str> = FIELDS.iter().map(|f| f.nr).collect();
|
||||
let count = nrs.len();
|
||||
nrs.sort_unstable();
|
||||
nrs.dedup();
|
||||
assert_eq!(nrs.len(), count);
|
||||
// The 24-hour stage requires exactly the glossary's eight.
|
||||
let required: Vec<&str> = FIELDS
|
||||
.iter()
|
||||
.filter(|f| f.stages[0] == Need::Required)
|
||||
.map(|f| f.nr)
|
||||
.collect();
|
||||
assert_eq!(required, ["1", "2", "3", "4", "5", "6", "7", "v26"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_draft_follows_the_srp_glossary() {
|
||||
let a = alert();
|
||||
let doc = draft(&EnisaInput {
|
||||
product: "Pump Remote",
|
||||
manufacturer: "example-pumps",
|
||||
tooling: "Prüfwerk test",
|
||||
alert: &a,
|
||||
aware_at: at("2026-10-06T08:00:00Z"),
|
||||
now: at("2026-10-06T09:00:00Z"),
|
||||
});
|
||||
assert_eq!(doc["status"], DRAFT_STAMP);
|
||||
assert_eq!(doc["submitted"], false);
|
||||
assert_eq!(doc["glossary"]["version"], "1.4");
|
||||
assert_eq!(doc["due"]["early_warning"], "2026-10-07T08:00:00Z");
|
||||
assert_eq!(
|
||||
doc["due"]["vulnerability_notification"],
|
||||
"2026-10-09T08:00:00Z"
|
||||
);
|
||||
let field = |stage: &str, nr: &str| {
|
||||
doc["stages"][stage]["fields"]
|
||||
.as_array()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.find(|f| f["nr"] == nr)
|
||||
.cloned()
|
||||
.unwrap_or_default()
|
||||
};
|
||||
assert_eq!(field("early_warning", "1")["value"], "Vulnerability");
|
||||
assert_eq!(field("early_warning", "v19")["value"], "CVE-2021-44228");
|
||||
assert_eq!(
|
||||
field("early_warning", "v26")["value"],
|
||||
"2026-10-06T08:00:00Z"
|
||||
);
|
||||
assert_eq!(
|
||||
field("early_warning", "5")["value"],
|
||||
serde_json::Value::Null
|
||||
);
|
||||
assert_eq!(
|
||||
field("early_warning", "5")["cra_art14_ref"],
|
||||
"Art. 14(2)(a)"
|
||||
);
|
||||
// The attack vector is not part of the early warning.
|
||||
assert!(field("early_warning", "18").is_null());
|
||||
assert_eq!(field("final_report", "16")["requirement"], "Required");
|
||||
assert_eq!(
|
||||
field("final_report", "17")["value"],
|
||||
"Update log4j-core to 2.17.1."
|
||||
);
|
||||
assert!(field("vulnerability_notification", "v21")["value"]
|
||||
.as_str()
|
||||
.is_some_and(|v| v.contains("Known Exploited Vulnerabilities")));
|
||||
assert!(field("final_report", "v27")["value"]
|
||||
.as_str()
|
||||
.is_some_and(|v| v.contains("ransomware")));
|
||||
let open: Vec<&str> = doc["to_complete"]
|
||||
.as_array()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter_map(|t| t.as_str())
|
||||
.collect();
|
||||
assert_eq!(
|
||||
open,
|
||||
[
|
||||
"early_warning: 5. Member States where product available (Concerned CSIRT)",
|
||||
"early_warning: 7. Product Version",
|
||||
"vulnerability_notification: v26a. Date and time when the Actively Exploited \
|
||||
Vulnerability occurred (UTC time)",
|
||||
"final_report: 16. Corrective or mitigating measures taken",
|
||||
"final_report: v22. Date when corrective or mitigating measure has been available",
|
||||
"final_report: v25. Full description of the Impact of the vulnerability",
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ pub mod config;
|
||||
pub mod control_check;
|
||||
pub mod csaf_docs;
|
||||
pub mod db;
|
||||
pub mod enisa_docs;
|
||||
pub mod error;
|
||||
pub mod exec_policy;
|
||||
#[cfg(feature = "net")]
|
||||
|
||||
@@ -98,6 +98,15 @@ pub struct CveAlert {
|
||||
with = "super::serde_helpers::opt_bson_datetime"
|
||||
)]
|
||||
pub resolved_at: Option<DateTime<Utc>>,
|
||||
/// When a scan first found it actively exploited (CISA KEV, SSVC
|
||||
/// `active`): when the manufacturer could become aware of it, from which
|
||||
/// the CRA's reporting deadlines run (Article 14(2); #498). Set once.
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none",
|
||||
with = "super::serde_helpers::opt_bson_datetime"
|
||||
)]
|
||||
pub exploited_seen_at: Option<DateTime<Utc>>,
|
||||
#[serde(with = "super::serde_helpers::bson_datetime")]
|
||||
pub created_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -139,6 +148,7 @@ impl CveAlert {
|
||||
exploitation: None,
|
||||
vex: None,
|
||||
resolved_at: None,
|
||||
exploited_seen_at: None,
|
||||
created_at: Utc::now(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5005,6 +5005,14 @@ tbody tr:last-child td {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.vex-enisa {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px 8px;
|
||||
align-items: center;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.vex-csaf {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -7,6 +7,7 @@ use dioxus::prelude::*;
|
||||
use dioxus_free_icons::icons::bs_icons::BsDownload;
|
||||
use dioxus_free_icons::Icon;
|
||||
|
||||
use compliance_core::enisa_docs::{reportability, Reportability};
|
||||
use compliance_core::models::{CveAlert, VexJustification, VexStatus};
|
||||
use compliance_core::vex_docs::status_of;
|
||||
|
||||
@@ -16,8 +17,8 @@ use crate::components::toast::{ToastType, Toasts};
|
||||
use crate::i18n::texts::{common, vex as tx};
|
||||
use crate::i18n::{use_lang, Lang, Text};
|
||||
use crate::infrastructure::vex::{
|
||||
csaf_filename, fetch_csaf_export, fetch_target_cves, fetch_vex_export, save_cve_vex, VexFormat,
|
||||
VexStatementDto,
|
||||
csaf_filename, enisa_filename, fetch_csaf_export, fetch_enisa_draft, fetch_target_cves,
|
||||
fetch_vex_export, save_cve_vex, VexFormat, VexStatementDto,
|
||||
};
|
||||
|
||||
/// Every status, in the order the editor offers them.
|
||||
@@ -167,6 +168,9 @@ pub fn VexPanel(target_id: String) -> Element {
|
||||
{tx::EDIT.get(lang)}
|
||||
}
|
||||
}
|
||||
if reportability(alert) == Reportability::Reportable {
|
||||
EnisaDraftButton { alert: alert.clone() }
|
||||
}
|
||||
}
|
||||
}
|
||||
if open {
|
||||
@@ -226,6 +230,47 @@ fn VexExportButton(target_id: String, format: VexFormat) -> Element {
|
||||
}
|
||||
}
|
||||
|
||||
/// The draft CRA Article 14 notification of an actively exploited
|
||||
/// vulnerability, and when its early warning is due.
|
||||
#[component]
|
||||
fn EnisaDraftButton(alert: CveAlert) -> Element {
|
||||
let lang = use_lang()();
|
||||
let mut toasts = use_context::<Toasts>();
|
||||
let mut busy = use_signal(|| false);
|
||||
let alert_id = alert.id.map(|o| o.to_hex()).unwrap_or_default();
|
||||
let filename = enisa_filename(alert.cve());
|
||||
let due = alert.exploited_seen_at.map(|at| {
|
||||
(at + chrono::Duration::hours(24))
|
||||
.format("%Y-%m-%d %H:%M UTC")
|
||||
.to_string()
|
||||
});
|
||||
rsx! {
|
||||
div { class: "vex-enisa",
|
||||
button {
|
||||
class: "btn btn-secondary btn-sm",
|
||||
title: tx::ENISA_HINT.get(lang),
|
||||
disabled: busy(),
|
||||
onclick: move |_| {
|
||||
let (id, name) = (alert_id.clone(), filename.clone());
|
||||
busy.set(true);
|
||||
spawn(async move {
|
||||
match fetch_enisa_draft(id).await {
|
||||
Ok(draft) => crate::infrastructure::download::save_json(&draft, &name),
|
||||
Err(e) => toasts.push(ToastType::Error, format!("{}: {e}", tx::EXPORT_FAILED.get(lang))),
|
||||
}
|
||||
busy.set(false);
|
||||
});
|
||||
},
|
||||
Icon { icon: BsDownload, width: 14, height: 14 }
|
||||
{tx::ENISA_DRAFT.get(lang)}
|
||||
}
|
||||
if let Some(due) = due {
|
||||
span { class: "target-muted", "{tx::ENISA_DUE.get(lang)} {due}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The CSAF draft download: the publisher's web address, and the button.
|
||||
#[component]
|
||||
fn CsafExport(target_id: String) -> Element {
|
||||
|
||||
@@ -2282,6 +2282,22 @@ pub mod vex {
|
||||
de: "CycloneDX VEX herunterladen",
|
||||
en: "Download CycloneDX VEX",
|
||||
};
|
||||
pub const ENISA_DRAFT: Text = Text {
|
||||
de: "ENISA-Meldung (Entwurf)",
|
||||
en: "ENISA notification (draft)",
|
||||
};
|
||||
pub const ENISA_HINT: Text = Text {
|
||||
de: "Aktiv ausgenutzt: Der CRA (Art. 14) verlangt eine Meldung an ENISA. Der Entwurf \
|
||||
enthält die Felder der ENISA-Meldeplattform; Sie prüfen, ergänzen und reichen \
|
||||
ihn selbst ein.",
|
||||
en: "Actively exploited: the CRA (Art. 14) requires a notification to ENISA. The draft \
|
||||
holds the fields of ENISA's reporting platform; you check, complete and submit \
|
||||
it yourself.",
|
||||
};
|
||||
pub const ENISA_DUE: Text = Text {
|
||||
de: "Frühwarnung fällig bis",
|
||||
en: "Early warning due by",
|
||||
};
|
||||
pub const EXPORT_CSAF: Text = Text {
|
||||
de: "CSAF-Entwurf herunterladen",
|
||||
en: "Download CSAF draft",
|
||||
|
||||
@@ -129,6 +129,28 @@ pub async fn fetch_csaf_export(
|
||||
.map_err(|e| ServerFnError::new(e.to_string()))
|
||||
}
|
||||
|
||||
/// The draft CRA Article 14 notification (ENISA's reporting platform fields)
|
||||
/// of alert `alert_id`, as text to save. The agent refuses (422) an alert
|
||||
/// that is not to be notified.
|
||||
#[server]
|
||||
pub async fn fetch_enisa_draft(alert_id: String) -> Result<String, ServerFnError> {
|
||||
let resp = super::agent_client::agent_get(&format!("/api/v1/cves/{alert_id}/enisa"))
|
||||
.await?
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
||||
super::agent_client::ok_response(resp)
|
||||
.await?
|
||||
.text()
|
||||
.await
|
||||
.map_err(|e| ServerFnError::new(e.to_string()))
|
||||
}
|
||||
|
||||
/// The file name of the draft notification of `cve`.
|
||||
pub fn enisa_filename(cve: &str) -> String {
|
||||
format!("enisa-draft-{}.json", cve.to_ascii_lowercase())
|
||||
}
|
||||
|
||||
/// The file name of a CSAF advisory, from its tracking id (CSAF 2.0 §5.1).
|
||||
pub fn csaf_filename(advisory: &str) -> String {
|
||||
serde_json::from_str::<serde_json::Value>(advisory)
|
||||
@@ -153,6 +175,14 @@ mod tests {
|
||||
assert_eq!(VexFormat::OpenVex.filename("65f0"), "vex-65f0.openvex.json");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_enisa_draft_is_named_after_its_cve() {
|
||||
assert_eq!(
|
||||
enisa_filename("CVE-2021-44228"),
|
||||
"enisa-draft-cve-2021-44228.json"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_csaf_file_is_named_after_its_tracking_id() {
|
||||
let advisory = r#"{"document":{"tracking":{"id":"pruefwerk-vex-pumps-20261006"}}}"#;
|
||||
|
||||
@@ -283,6 +283,10 @@ API: `GET /api/v1/targets/{id}/cves` lists the alerts with their statements,
|
||||
`GET /api/v1/targets/{id}/csaf?namespace=<publisher URL>&lang=de|en` the same
|
||||
statements as a CSAF 2.0 VEX advisory (a TLP:AMBER draft; see
|
||||
[Assessing vulnerabilities](./vex-en.md#csaf-draft)).
|
||||
`GET /api/v1/targets/{id}/enisa` lists the actively exploited alerts and whether
|
||||
CRA Art. 14 asks for a notification; `GET /api/v1/cves/{id}/enisa?aware_at=<RFC 3339>`
|
||||
downloads the draft notification in the fields of ENISA's reporting platform (see
|
||||
[Assessing vulnerabilities](./vex-en.md#enisa-notification-cra-art-14)).
|
||||
|
||||
## SBOM quality
|
||||
|
||||
|
||||
@@ -77,3 +77,42 @@ the publisher and the statements and set the TLP label to **WHITE** (public;
|
||||
"CLEAR" in TLP 2.0) or **GREEN**. The draft passes the CSAF schema and the
|
||||
standard's mandatory tests. It is also in the evidence pack
|
||||
(`csaf-vex.json`, with the placeholder).
|
||||
|
||||
## ENISA notification (CRA Art. 14)
|
||||
|
||||
Since 11 September 2026, manufacturers must notify **actively exploited
|
||||
vulnerabilities** in their products through ENISA's reporting platform (CRA
|
||||
Art. 14(1) and (2)): an **early warning within 24 hours**, a **vulnerability
|
||||
notification within 72 hours** and a **final report no later than 14 days**
|
||||
after a corrective measure is available.
|
||||
|
||||
Prüfwerk recognises actively exploited vulnerabilities from CISA's KEV
|
||||
catalog and the SSVC exploitation "active". Where the product is affected or
|
||||
under investigation, or the vulnerability was fixed after a scan found it
|
||||
exploited (then the final report is due), the row shows **ENISA notification (draft)** and when
|
||||
the early warning is due (24 hours after the scan that first found the
|
||||
exploitation). The draft
|
||||
|
||||
- holds the platform's fields in their order, per stage (early warning,
|
||||
72-hour notification, final report), with number, name, requirement as
|
||||
ENISA states it and the point of Art. 14 it serves (`cra_art14_ref`),
|
||||
following the **ENISA CRA SRP Glossary, version 1.4 of 1 October 2026**
|
||||
(recorded in the draft under `glossary`);
|
||||
- fills what Prüfwerk knows: product, component, CVE, the nature of the
|
||||
exploitation, measures from your VEX statement, severity;
|
||||
- lists under `to_complete` what only you know: always the Member States
|
||||
where the product is made available, and the product version, when the
|
||||
exploitation occurred, the measures taken and the date the fix became
|
||||
available;
|
||||
- is stamped **"Draft, not submitted"**. Prüfwerk submits nothing: you enter
|
||||
the data in the reporting platform (`portal.cra-srp.enisa.europa.eu`)
|
||||
yourself, through the CSIRT of your main establishment.
|
||||
|
||||
Through the API you can give the time the deadlines run from (`aware_at`);
|
||||
without it, the first scan that found the exploitation counts. For a fixed
|
||||
vulnerability the draft carries the date of the fix (field v22) and the final
|
||||
report's deadline. A vulnerability assessed "Not affected", or fixed before
|
||||
any scan found it exploited, gets no draft. Actively
|
||||
exploited vulnerabilities are also in the evidence pack as
|
||||
`enisa-drafts.json`. When ENISA changes the glossary we update the fields;
|
||||
the version in a draft shows which one it follows.
|
||||
@@ -81,3 +81,43 @@ TLP-Kennzeichnung auf **WHITE** (öffentlich, in TLP 2.0 „CLEAR“) oder
|
||||
**GREEN**. Der Entwurf besteht das CSAF-Schema und die Pflichttests des
|
||||
CSAF-Standards. Er liegt auch im Nachweispaket (`csaf-vex.json`, mit
|
||||
Platzhalter).
|
||||
|
||||
## ENISA-Meldung (CRA Art. 14)
|
||||
|
||||
Seit dem 11. September 2026 müssen Hersteller **aktiv ausgenutzte
|
||||
Schwachstellen** in ihren Produkten über die Meldeplattform der ENISA melden
|
||||
(CRA Art. 14(1) und (2)): eine **Frühwarnung binnen 24 Stunden**, eine
|
||||
**Schwachstellenmeldung binnen 72 Stunden** und einen **Abschlussbericht
|
||||
spätestens 14 Tage**, nachdem eine Abhilfe verfügbar ist.
|
||||
|
||||
Prüfwerk erkennt aktiv ausgenutzte Schwachstellen über den KEV-Katalog der
|
||||
CISA und die SSVC-Bewertung „active“. Ist das Produkt betroffen oder in
|
||||
Prüfung, oder wurde die Schwachstelle behoben, nachdem eine Prüfung ihre
|
||||
Ausnutzung fand (dann ist der Abschlussbericht fällig), zeigt die Zeile **ENISA-Meldung (Entwurf)** und die Frist der
|
||||
Frühwarnung (24 Stunden ab der Prüfung, die die Ausnutzung zuerst fand). Der
|
||||
Entwurf
|
||||
|
||||
- enthält die Felder der Meldeplattform in ihrer Reihenfolge, je Phase
|
||||
(Frühwarnung, 72-Stunden-Meldung, Abschlussbericht), mit Nummer, Name,
|
||||
Pflicht laut ENISA und dem Bezug in Art. 14 (`cra_art14_ref`), nach dem
|
||||
**ENISA CRA SRP Glossary, Version 1.4 vom 1. Oktober 2026** (im Entwurf
|
||||
unter `glossary` vermerkt);
|
||||
- füllt, was Prüfwerk weiß: Produkt, Komponente, CVE, Art der Ausnutzung,
|
||||
Abhilfe aus Ihrer VEX-Aussage, Schweregrad;
|
||||
- listet unter `to_complete`, was nur Sie wissen: immer die Mitgliedstaaten,
|
||||
in denen das Produkt bereitgestellt wird, dazu Produktversion, Zeitpunkt der
|
||||
Ausnutzung, ergriffene Maßnahmen und Datum der Abhilfe;
|
||||
- ist als **„Draft, not submitted“** gekennzeichnet. Prüfwerk reicht nichts
|
||||
ein: Sie übertragen die Angaben selbst in die Meldeplattform
|
||||
(`portal.cra-srp.enisa.europa.eu`), über die zuständige CSIRT Ihres
|
||||
Hauptsitzes.
|
||||
|
||||
Den Zeitpunkt, ab dem die Fristen laufen, können Sie über die API angeben
|
||||
(`aware_at`); ohne ihn gilt die erste Prüfung, die die Ausnutzung fand. Ist
|
||||
eine behobene Schwachstelle bekannt, trägt der Entwurf das Datum der Behebung
|
||||
(Feld v22) und die Frist des Abschlussberichts. Ist sie als „Nicht
|
||||
betroffen“ bewertet, oder wurde sie behoben, bevor eine Prüfung ihre
|
||||
Ausnutzung fand, gibt es keinen Entwurf. Aktiv ausgenutzte Schwachstellen stehen als
|
||||
`enisa-drafts.json` auch im Nachweispaket. Ändert ENISA das Glossar,
|
||||
passen wir die Felder an; die Version im Entwurf zeigt, nach welchem er
|
||||
erstellt wurde.
|
||||
@@ -30,6 +30,7 @@ together on stage in one pass before the next prod promotion.
|
||||
| #498 (3/4) | CSAF 2.0 VEX advisory draft |
|
||||
| #508 (B1) | Lockfile hashes and download URLs in the SBOM |
|
||||
| #508 (B2) | Component creator (project URL) in the SBOM |
|
||||
| #498 (4/4) | Draft ENISA notifications (CRA Art. 14) for actively exploited vulnerabilities |
|
||||
|
||||
**Customer-visible on the next prod rescan** is marked **[visible]**: these
|
||||
change what a customer sees on their existing targets, without them doing
|
||||
@@ -646,6 +647,41 @@ Use the targets of check 29 and a Go module.
|
||||
- **[visible]** SBOM exports and evidence packs name component creators
|
||||
after the next rescan.
|
||||
|
||||
### 31. #498 part 4: draft ENISA notifications (CRA Art. 14)
|
||||
|
||||
Use the log4j target of check 19 (CVE-2021-44228 is in CISA's KEV).
|
||||
|
||||
- **Do:** rescan; open the target's **Schwachstellen und VEX**. **Expect:**
|
||||
the log4j row has **ENISA-Meldung (Entwurf)** and "Frühwarnung fällig bis
|
||||
<date>" (24 h after this scan); rows without KEV/SSVC-active have no
|
||||
button. Log/Mongo: the alert has `exploited_seen_at`, unchanged by a second
|
||||
rescan. Note: every alert already in KEV gets the first post-deploy scan as
|
||||
`exploited_seen_at`, so for long-known CVEs the due time is "now + 24 h"
|
||||
of that scan (or already past on a later look); the API's `aware_at`
|
||||
overrides it.
|
||||
- **Do:** download the draft. **Expect:** `enisa-draft-cve-2021-44228.json`
|
||||
with `status` "Draft, not submitted", `submitted: false`, `glossary`
|
||||
version 1.4 (2026-10-01), `due` 24 h and 72 h after `aware_at`, and three
|
||||
stages whose fields carry the SRP glossary's numbers, names and
|
||||
requirements and a `cra_art14_ref`; field 1 "Vulnerability", v19 the CVE,
|
||||
v27 names ransomware use where KEV says so. `to_complete` always lists
|
||||
field 5 (Member States).
|
||||
- **Do:** update log4j-core to 2.17.1, rescan. **Expect:** the alert turns
|
||||
"Behoben" (by the scan) and still has the button: the draft's v22 is the
|
||||
rescan's time and `due.final_report` 14 days later.
|
||||
- **Do:** set the alert to "Nicht betroffen", reload. **Expect:** no button;
|
||||
`GET /api/v1/cves/<id>/enisa` answers 422 with the reason.
|
||||
`GET /api/v1/targets/<id>/enisa` lists it with `reportable: false`.
|
||||
- **Do:** `GET /api/v1/cves/<id>/enisa?aware_at=2026-10-06T08:00:00Z` on a
|
||||
reportable alert. **Expect:** `due.early_warning` 2026-10-07T08:00:00Z;
|
||||
`aware_at=yesterday` gives 400.
|
||||
- **Do:** download the evidence pack. **Expect:** `enisa-drafts.json` when
|
||||
an alert is reportable, none otherwise.
|
||||
- **Docs:** `/guide/vex` and `/guide/vex-en` have the ENISA section.
|
||||
- **[visible]** a new button and due time on actively exploited
|
||||
vulnerabilities; the evidence pack gains `enisa-drafts.json` where there
|
||||
are any.
|
||||
|
||||
## After the pass
|
||||
|
||||
- The nightly job on `main` is green with the new mobile targets.
|
||||
|
||||
Reference in new issue
Block a user