fix(plc): CVE alerts of PLC targets resolve, their issues sync
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 10m5s
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 10m5s
persist_control_app_sbom stored a PLC target's CVE alerts but never did what the code pipeline does at its end: resolve_gone and sync_cve_issues. So a CVE of a CODESYS runtime or library the project no longer references stayed open for good, and a PLC project in a managed repository never got CVE issues. - The PLC path tracks whether its lookups were complete (OSV without unchecked components or failure/timeout, the CODESYS NVD match without unchecked or timeout) and then calls resolve_gone with the target's alerts (PLC targets run only this path, so these are all its alerts). - With a code artifact (managed git), sync_cve_issues follows, as for code. - Docs (PLC guide), test plan check 34. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
1 parent
d96509db8c
commit
bf0a19c86b
3 files changed
+56
-3
No files matched your search
@@ -1288,7 +1288,7 @@ impl PipelineOrchestrator {
|
||||
|
||||
if !all_sbom.is_empty() {
|
||||
if let Err(e) = self
|
||||
.persist_control_app_sbom(target_id, scan_run_id, &target.name, all_sbom)
|
||||
.persist_control_app_sbom(target, target_id, scan_run_id, all_sbom)
|
||||
.await
|
||||
{
|
||||
tracing::warn!(target_id, error = %e, "control-app SBOM persist failed");
|
||||
@@ -1448,9 +1448,9 @@ impl PipelineOrchestrator {
|
||||
/// this is where PLC-device CVE coverage comes from.
|
||||
async fn persist_control_app_sbom(
|
||||
&self,
|
||||
target: &OnboardedTarget,
|
||||
target_id: &str,
|
||||
scan_run_id: &str,
|
||||
target_name: &str,
|
||||
mut entries: Vec<SbomEntry>,
|
||||
) -> Result<(), AgentError> {
|
||||
if entries.is_empty() {
|
||||
@@ -1468,6 +1468,9 @@ impl PipelineOrchestrator {
|
||||
k.expose_secret().to_string()
|
||||
}),
|
||||
)?;
|
||||
// Whether both lookups covered every component: only then are the
|
||||
// alerts they no longer report gone (as in the code pipeline).
|
||||
let mut complete = true;
|
||||
let mut alerts = match tokio::time::timeout(
|
||||
std::time::Duration::from_secs(600),
|
||||
cve_scanner.scan_dependencies(target_id, &mut entries),
|
||||
@@ -1475,18 +1478,21 @@ impl PipelineOrchestrator {
|
||||
.await
|
||||
{
|
||||
Ok(Ok(lookup)) => {
|
||||
complete &= lookup.unchecked.is_empty();
|
||||
self.record_osv_unchecked(scan_run_id, &lookup.unchecked)
|
||||
.await;
|
||||
lookup.alerts
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
tracing::warn!(target_id, error = %e, "control-app CVE scan failed");
|
||||
complete = false;
|
||||
self.record_cve_gap(scan_run_id, "OSV", "the OSV lookup failed")
|
||||
.await;
|
||||
Vec::new()
|
||||
}
|
||||
Err(_) => {
|
||||
tracing::warn!(target_id, "control-app CVE scan timed out");
|
||||
complete = false;
|
||||
self.record_cve_gap(
|
||||
scan_run_id,
|
||||
"OSV",
|
||||
@@ -1507,6 +1513,7 @@ impl PipelineOrchestrator {
|
||||
Ok(lookup) => {
|
||||
alerts.extend(lookup.alerts);
|
||||
if !lookup.unchecked.is_empty() {
|
||||
complete = false;
|
||||
self.record_cve_gap(
|
||||
scan_run_id,
|
||||
&format!("NVD: {}", lookup.unchecked.join(", ")),
|
||||
@@ -1517,6 +1524,7 @@ impl PipelineOrchestrator {
|
||||
}
|
||||
Err(_) => {
|
||||
tracing::warn!(target_id, "CODESYS CVE match timed out");
|
||||
complete = false;
|
||||
self.record_cve_gap(
|
||||
scan_run_id,
|
||||
"NVD",
|
||||
@@ -1543,8 +1551,26 @@ impl PipelineOrchestrator {
|
||||
}
|
||||
}
|
||||
let new_notifs = self
|
||||
.persist_cve_alerts(target_id, target_name, &alerts)
|
||||
.persist_cve_alerts(target_id, &target.name, &alerts)
|
||||
.await?;
|
||||
// What the code pipeline does at its end: a complete lookup resolves
|
||||
// the alerts it no longer reports, and a managed repository's CVE
|
||||
// issues follow.
|
||||
if let Err(e) =
|
||||
crate::pipeline::vex_lifecycle::resolve_gone(&self.db, target_id, &alerts, complete)
|
||||
.await
|
||||
{
|
||||
tracing::warn!(target_id, "Marking resolved CVE alerts failed: {e}");
|
||||
}
|
||||
if let Some(code) = target.code_artifact() {
|
||||
let repo = RepoView::from_target(target, code, &self.secrets);
|
||||
if let Err(e) = self
|
||||
.sync_cve_issues(&repo, target_id, &alerts, complete)
|
||||
.await
|
||||
{
|
||||
tracing::warn!(target_id, "CVE issue sync failed: {e}");
|
||||
}
|
||||
}
|
||||
tracing::info!(
|
||||
target_id,
|
||||
components = entries.len(),
|
||||
|
||||
@@ -144,6 +144,11 @@ guard-aware), cleartext/insecure communication (CWE-319), insecure protocol port
|
||||
The **SBOM** view lists the CODESYS libraries (`pkg:codesys/<name>@<version>`) and
|
||||
the runtime; matching runtime components (e.g. the `Cmp*` / `3SLicense` libraries)
|
||||
surface real CODESYS advisories as CVE alerts.
|
||||
A CVE alert a later scan no longer finds (the project now references a fixed
|
||||
runtime or library version) is marked resolved, and its VEX status becomes
|
||||
`fixed`, as for code targets; this needs both lookups (OSV and NVD) to have
|
||||
covered every component. For a PLC project in a managed Git repository, the CVE
|
||||
issues in the repository follow, as for code.
|
||||
|
||||
## Dynamic testing — ICS protocol probe
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ together on stage in one pass before the next prod promotion.
|
||||
| #498 (4/4) | Draft ENISA notifications (CRA Art. 14) for actively exploited vulnerabilities |
|
||||
| #498 (follow-up) | ENISA deadlines evaluated by the agent; one notification per CVE |
|
||||
| #516 | Secret scanning with Betterleaks instead of gitleaks |
|
||||
| PLC CVE fix | CVE alerts of PLC targets resolve; their issues sync |
|
||||
|
||||
**Customer-visible on the next prod rescan** is marked **[visible]**: these
|
||||
change what a customer sees on their existing targets, without them doing
|
||||
@@ -724,6 +725,27 @@ Use the log4j target of check 31.
|
||||
- **[visible]** more secret findings on some targets (new Betterleaks
|
||||
rules); a few existing ones show another rule name.
|
||||
|
||||
### 34. PLC targets: CVE alerts resolve and their issues sync
|
||||
|
||||
Before, a PLC target's CVE alerts were never marked resolved and never
|
||||
created or closed issues in a managed repository.
|
||||
|
||||
- **Do:** upload `fixtures/nightly/plc/line_control.projectarchive` (CODESYS
|
||||
Control for Linux SL 3.5.16.0, many CODESYS CVEs) as a PLC target; then
|
||||
edit the archive so the device descriptor names a newer runtime (e.g.
|
||||
`3.5.22.40`), re-upload, rescan. **Expect:** the CVEs fixed before
|
||||
3.5.22.40 are marked resolved with VEX status `fixed` (by the scan); a
|
||||
person's `not_affected` stays. Log: `CVE alerts no longer found marked
|
||||
resolved`.
|
||||
- **Do:** make the NVD lookup fail (e.g. block `services.nvd.nist.gov`)
|
||||
and rescan. **Expect:** nothing is resolved (the lookup was incomplete),
|
||||
and the scan run lists the CVE gap.
|
||||
- **Do:** a PLC project in a managed Gitea repository with critical/high
|
||||
CODESYS CVEs. **Expect:** CVE issues are created in the repository, and
|
||||
closed once the runtime is updated.
|
||||
- **[visible]** PLC targets' fixed CVEs leave the open list after the next
|
||||
rescan; managed PLC repositories get CVE issues.
|
||||
|
||||
## After the pass
|
||||
|
||||
- The nightly job on `main` is green with the new mobile targets.
|
||||
|
||||
Reference in new issue
Block a user