Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1484e1074 | ||
|
|
ecfee6db6e | ||
|
|
30079c6504 |
No files matched your search
Generated
+9
-9
@@ -601,7 +601,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "compliance-agent"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"base64 0.22.1",
|
||||
@@ -657,7 +657,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "compliance-core"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"axum",
|
||||
@@ -689,7 +689,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "compliance-dashboard"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum",
|
||||
@@ -727,7 +727,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "compliance-dast"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"base64 0.22.1",
|
||||
@@ -749,7 +749,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "compliance-graph"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
dependencies = [
|
||||
"bson",
|
||||
"chrono",
|
||||
@@ -774,7 +774,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "compliance-mcp"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"bson",
|
||||
@@ -797,7 +797,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "compliance-smoke"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"compliance-core",
|
||||
@@ -932,7 +932,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "control-map"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -7127,7 +7127,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "werkbank-exec"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
dependencies = [
|
||||
"compliance-core",
|
||||
"compliance-dast",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "compliance-agent"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
edition = "2021"
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "compliance-core"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
edition = "2021"
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "compliance-dashboard"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
edition = "2021"
|
||||
default-run = "compliance-dashboard"
|
||||
|
||||
|
||||
@@ -3169,6 +3169,26 @@ pub mod sbom {
|
||||
requirements.txt; for JavaScript, npm install writes package-lock.json; for Rust, \
|
||||
commit Cargo.lock. After the next scan the components are listed here.",
|
||||
};
|
||||
/// Why a PLC target's component table is empty.
|
||||
pub const EMPTY_WHY_PLC: Text = Text {
|
||||
de: "Bei einer SPS-Anwendung entsteht die Stückliste aus den Bibliotheken und der \
|
||||
Laufzeit eines CODESYS-Projektarchivs (.projectarchive) und aus den \
|
||||
Siemens-Steuerungen, die auf der Seite „Steuerungen“ des Prüfobjekts eingetragen \
|
||||
sind. Structured Text und PLCopen XML allein nennen keine Komponenten.",
|
||||
en: "For a PLC application the SBOM is built from the libraries and runtime in a \
|
||||
CODESYS project archive (.projectarchive) and from the Siemens controllers \
|
||||
entered on the target's Controllers page. Structured Text and PLCopen XML alone \
|
||||
name no components.",
|
||||
};
|
||||
/// How to fill a PLC target's component table, by example.
|
||||
pub const EMPTY_EXAMPLE_PLC: Text = Text {
|
||||
de: "Zum Beispiel: Tragen Sie auf der Seite „Steuerungen“ die CPU mit Artikelnummer \
|
||||
und Firmware ein (etwa 6ES7511-1AK02-0AB0, V2.9.4), oder laden Sie das \
|
||||
CODESYS-Projektarchiv hoch. Nach der nächsten Prüfung stehen die Komponenten hier.",
|
||||
en: "For example: enter the CPU with its order number and firmware on the Controllers \
|
||||
page (such as 6ES7511-1AK02-0AB0, V2.9.4), or upload the CODESYS project archive. \
|
||||
After the next scan the components are listed here.",
|
||||
};
|
||||
/// Above the open findings that say what is missing.
|
||||
pub const EMPTY_FINDINGS: Text = Text {
|
||||
de: "Was in diesem Prüfobjekt fehlt und wie Sie es ergänzen:",
|
||||
@@ -5786,20 +5806,22 @@ pub mod metering {
|
||||
/// The plan's refusal of a new target (`target_limit`): its places are
|
||||
/// all taken.
|
||||
pub const TARGET_LIMIT: Text = Text {
|
||||
de: "Ihr Tarif enthält keine weiteren Prüfobjekte. Archivieren Sie ein Prüfobjekt, \
|
||||
um ein neues anzulegen, oder wechseln Sie den Tarif.",
|
||||
en: "Your plan includes no further targets. Archive a target to add a new one, \
|
||||
or change your plan.",
|
||||
de: "Ihr Tarif enthält keine weiteren Prüfobjekte. Löschen Sie ein Prüfobjekt, \
|
||||
um ein neues anzulegen (seine Ergebnisse werden mit gelöscht), oder wechseln \
|
||||
Sie den Tarif.",
|
||||
en: "Your plan includes no further targets. Delete a target to add a new one \
|
||||
(its results are deleted with it), or change your plan.",
|
||||
};
|
||||
/// The plan's refusal to make a demo target the tenant's own
|
||||
/// (`target_limit`): other sources would make it count, and its places
|
||||
/// are all taken.
|
||||
pub const DEMO_LIMIT: Text = Text {
|
||||
de: "Mit eigenen Dateien oder Quellen zählt ein Demo-Prüfobjekt wie Ihre anderen, \
|
||||
und Ihr Tarif enthält keine weiteren Prüfobjekte. Archivieren Sie ein \
|
||||
Prüfobjekt oder wechseln Sie den Tarif.",
|
||||
und Ihr Tarif enthält keine weiteren Prüfobjekte. Löschen Sie ein anderes \
|
||||
Prüfobjekt (seine Ergebnisse werden mit gelöscht) oder wechseln Sie den Tarif.",
|
||||
en: "With your own files or sources a demo target counts like your other targets, \
|
||||
and your plan includes no further targets. Archive a target or change your plan.",
|
||||
and your plan includes no further targets. Delete another target (its results \
|
||||
are deleted with it) or change your plan.",
|
||||
};
|
||||
/// A failed creation of a target in words: the plan's refusal as
|
||||
/// [`TARGET_LIMIT`], anything else as it came.
|
||||
|
||||
@@ -998,8 +998,8 @@ mod tests {
|
||||
let error = "error running server function: target_limit (409) (details: None)";
|
||||
assert_eq!(
|
||||
metering::target_refusal(error, Lang::En),
|
||||
"Your plan includes no further targets. Archive a target to add a new one, \
|
||||
or change your plan."
|
||||
"Your plan includes no further targets. Delete a target to add a new one \
|
||||
(its results are deleted with it), or change your plan."
|
||||
);
|
||||
assert_eq!(metering::target_refusal("x (500)", Lang::De), "x (500)");
|
||||
}
|
||||
|
||||
@@ -350,7 +350,10 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element
|
||||
// ── SBOM table ──
|
||||
match &*sbom.read() {
|
||||
Some(Some(resp)) if resp.data.is_empty() && unfiltered() => rsx! {
|
||||
SbomEmpty { target_id: repo_filter() }
|
||||
SbomEmpty {
|
||||
target_id: repo_filter(),
|
||||
plc: is_plc_target(repos.read().as_ref().and_then(|r| r.as_ref()).map(|r| r.data.as_slice()), &repo_filter()),
|
||||
}
|
||||
},
|
||||
Some(Some(resp)) => {
|
||||
let total_pages = resp.total.unwrap_or(0).div_ceil(50).max(1);
|
||||
@@ -1039,6 +1042,19 @@ fn kev_title(kev: &KevData, lang: Lang) -> String {
|
||||
title
|
||||
}
|
||||
|
||||
/// Whether the target `id` among `targets` (the targets list's documents)
|
||||
/// is a PLC application (`target_type` `plc_sps`).
|
||||
fn is_plc_target(targets: Option<&[serde_json::Value]>, id: &str) -> bool {
|
||||
!id.is_empty()
|
||||
&& targets.unwrap_or_default().iter().any(|t| {
|
||||
t.get("_id")
|
||||
.and_then(|o| o.get("$oid"))
|
||||
.and_then(|s| s.as_str())
|
||||
== Some(id)
|
||||
&& t.get("target_type").and_then(|v| v.as_str()) == Some("plc_sps")
|
||||
})
|
||||
}
|
||||
|
||||
/// An EPSS badge's text: the probability and the percentile, in percent
|
||||
/// (`EPSS 94.4 % · P99`).
|
||||
fn epss_label(epss: &EpssData) -> String {
|
||||
@@ -1052,9 +1068,10 @@ fn epss_label(epss: &EpssData) -> String {
|
||||
/// The component table's empty state (#979): why the SBOM is empty, and the
|
||||
/// target's open findings that say what it is missing and how to add it, or
|
||||
/// an example where there are none (all targets, or code such as C that has
|
||||
/// no standard manifest).
|
||||
/// no standard manifest). A PLC target (`plc`) gets its own reason and
|
||||
/// example: its components come from a CODESYS archive or its controllers.
|
||||
#[component]
|
||||
fn SbomEmpty(target_id: ReadSignal<String>) -> Element {
|
||||
fn SbomEmpty(target_id: ReadSignal<String>, plc: bool) -> Element {
|
||||
let lang = use_lang()();
|
||||
let findings = use_resource(move || async move {
|
||||
let repo_id = target_id();
|
||||
@@ -1076,9 +1093,9 @@ fn SbomEmpty(target_id: ReadSignal<String>) -> Element {
|
||||
rsx! {
|
||||
section { class: "card sbom-empty",
|
||||
h3 { class: "sbom-quality-head", {tx::EMPTY_TITLE.get(lang)} }
|
||||
p { {tx::EMPTY_WHY.get(lang)} }
|
||||
p { if plc { {tx::EMPTY_WHY_PLC.get(lang)} } else { {tx::EMPTY_WHY.get(lang)} } }
|
||||
if findings.is_empty() {
|
||||
p { {tx::EMPTY_EXAMPLE.get(lang)} }
|
||||
p { if plc { {tx::EMPTY_EXAMPLE_PLC.get(lang)} } else { {tx::EMPTY_EXAMPLE.get(lang)} } }
|
||||
} else {
|
||||
p { {tx::EMPTY_FINDINGS.get(lang)} }
|
||||
ul { class: "sbom-empty-findings",
|
||||
@@ -1158,3 +1175,24 @@ fn grade_class(grade: &str) -> &'static str {
|
||||
_ => "badge-critical",
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn only_a_plc_target_gets_the_plc_explanation() {
|
||||
// Arrange
|
||||
let targets = vec![
|
||||
serde_json::json!({ "_id": { "$oid": "a1" }, "target_type": "plc_sps" }),
|
||||
serde_json::json!({ "_id": { "$oid": "b2" }, "target_type": "web_app" }),
|
||||
];
|
||||
|
||||
// Act + Assert
|
||||
assert!(is_plc_target(Some(&targets), "a1"));
|
||||
assert!(!is_plc_target(Some(&targets), "b2"));
|
||||
assert!(!is_plc_target(Some(&targets), "c3"));
|
||||
assert!(!is_plc_target(Some(&targets), ""), "all targets");
|
||||
assert!(!is_plc_target(None, "a1"), "targets not loaded yet");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "compliance-dast"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
edition = "2021"
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "compliance-graph"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
edition = "2021"
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "compliance-mcp"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "compliance-smoke"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
edition = "2021"
|
||||
description = "Tiny Axum service exercising compliance-core M7.1 tenant gating. Run smoke.sh against it before merging anything that touches the auth/tenant path."
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "control-map"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
edition = "2021"
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "werkbank-exec"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
edition = "2021"
|
||||
description = "Shared dynamic-execution logic: soft-PLC provisioning + industrial-protocol probing, used by the compliance agent and the Werkbank runner."
|
||||
|
||||
|
||||
Reference in new issue
Block a user