From 12855c2a4c47e2633cfc85658ba4d28c9b94abd8 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Mon, 5 Oct 2026 19:53:26 +0200 Subject: [PATCH] fix(dashboard): readable tool names for findings, including the new .NET and mobile checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Findings showed the scanner's internal name (`dotnet-config`, `secret-files`, `dotnet-lifecycle`, `mobsfscan`, `gdpr-patterns`). findings::tool_name gives every known tool a German and English name (".NET-Konfiguration", "Schlüsseldateien im Repository", ".NET-Version ohne Support", "Mobile-App-Analyse (mobsfscan)", …); an unknown tool keeps its own. Used in the findings list and on the finding page (the internal name stays as the tooltip) and in the CRA view's "did not complete" reason. The skipped stages sast_mobile, lfs_objects, sast_vendor_code and sbom_dependencies already have their names. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p --- compliance-dashboard/src/i18n/texts.rs | 95 ++++++++++++++++++- .../src/pages/finding_detail.rs | 4 +- compliance-dashboard/src/pages/findings.rs | 2 +- 3 files changed, 95 insertions(+), 6 deletions(-) diff --git a/compliance-dashboard/src/i18n/texts.rs b/compliance-dashboard/src/i18n/texts.rs index 87ed01b..e161c62 100644 --- a/compliance-dashboard/src/i18n/texts.rs +++ b/compliance-dashboard/src/i18n/texts.rs @@ -1694,6 +1694,71 @@ pub mod findings { } } + /// The name of the tool that reported a finding (`Finding::scanner`), in + /// words; an unknown tool keeps its own name. + pub fn tool_name(scanner: &str, lang: super::super::Lang) -> String { + let text = match scanner { + "semgrep" => Text { + de: "Codeanalyse (Semgrep)", + en: "Code analysis (Semgrep)", + }, + "cppcheck" => Text { + de: "C/C++-Analyse (cppcheck)", + en: "C/C++ analysis (cppcheck)", + }, + "mobsfscan" => Text { + de: "Mobile-App-Analyse (mobsfscan)", + en: "Mobile app analysis (mobsfscan)", + }, + "gitleaks" => Text { + de: "Zugangsdaten im Code (gitleaks)", + en: "Secrets in the code (gitleaks)", + }, + "secret-files" => Text { + de: "Schlüsseldateien im Repository", + en: "Key files in the repository", + }, + "dotnet-config" => Text { + de: ".NET-Konfiguration", + en: ".NET configuration", + }, + "dotnet-lifecycle" => Text { + de: ".NET-Version ohne Support", + en: ".NET version out of support", + }, + "gdpr-patterns" => Text { + de: "Datenschutz-Muster", + en: "Privacy patterns", + }, + "oauth-patterns" => Text { + de: "OAuth-Muster", + en: "OAuth patterns", + }, + "plc-control-logic" => Text { + de: "SPS-Regeln", + en: "PLC rules", + }, + "control-check" => Text { + de: "CRA-Kontrollprüfung (KI)", + en: "CRA control check (AI)", + }, + "osv" => Text { + de: "CVE-Abgleich (OSV)", + en: "CVE lookup (OSV)", + }, + "syft" => Text { + de: "Stückliste (Syft)", + en: "SBOM (Syft)", + }, + "manual" => Text { + de: "Manuell erfasst", + en: "Entered by hand", + }, + other => return other.to_string(), + }; + text.get(lang).to_string() + } + /// A user of the tenant whose name is not known. pub const SOMEONE: Text = Text { de: "Benutzer", @@ -2276,8 +2341,8 @@ pub mod compliance { .iter() .filter_map(serde_json::Value::as_str) .map(|tool| match tool { - "osv" => CVE_LOOKUP.get(lang), - other => other, + "osv" => CVE_LOOKUP.get(lang).to_string(), + other => super::findings::tool_name(other, lang), }) .collect::>() .join(", ") @@ -2289,6 +2354,30 @@ pub mod compliance { #[cfg(test)] mod tests { use super::super::super::Lang; + + #[test] + fn tool_names_read_as_words_and_unknown_ones_stay() { + assert_eq!( + crate::i18n::texts::findings::tool_name("dotnet-config", Lang::De), + ".NET-Konfiguration" + ); + assert_eq!( + crate::i18n::texts::findings::tool_name("secret-files", Lang::En), + "Key files in the repository" + ); + assert_eq!( + crate::i18n::texts::findings::tool_name("dotnet-lifecycle", Lang::De), + ".NET-Version ohne Support" + ); + assert_eq!( + crate::i18n::texts::findings::tool_name("mobsfscan", Lang::En), + "Mobile app analysis (mobsfscan)" + ); + assert_eq!( + crate::i18n::texts::findings::tool_name("clippy", Lang::De), + "clippy" + ); + } use super::*; #[test] @@ -2296,7 +2385,7 @@ pub mod compliance { let reason = serde_json::json!({ "kind": "tool_failed", "tools": ["osv", "semgrep"] }); assert_eq!( not_assessed_reason(&reason, Lang::De).as_deref(), - Some("Bei der letzten Prüfung nicht vollständig gelaufen: CVE-Abgleich, semgrep") + Some("Bei der letzten Prüfung nicht vollständig gelaufen: CVE-Abgleich, Codeanalyse (Semgrep)") ); } diff --git a/compliance-dashboard/src/pages/finding_detail.rs b/compliance-dashboard/src/pages/finding_detail.rs index 6db14fd..d28047b 100644 --- a/compliance-dashboard/src/pages/finding_detail.rs +++ b/compliance-dashboard/src/pages/finding_detail.rs @@ -106,7 +106,7 @@ pub fn FindingDetailPage(id: String) -> Element { title: f.title.clone(), description: format!( "{} | {} | {}", - f.scanner, + tx::tool_name(&f.scanner, lang), tx::scan_type(&f.scan_type).get(lang), tx::status(&f.status).get(lang) ), @@ -151,7 +151,7 @@ pub fn FindingDetailPage(id: String) -> Element { span { style: "font-family: monospace;", "{place}" } } span { style: "opacity: 0.7;", {tx::COL_SCANNER.get(lang)} } - span { "{f.scanner}" } + span { title: "{f.scanner}", {tx::tool_name(&f.scanner, lang)} } if let Some(who) = &f.reported_by { span { style: "opacity: 0.7;", {tx::REPORTED_BY.get(lang)} } span { "{who}" } diff --git a/compliance-dashboard/src/pages/findings.rs b/compliance-dashboard/src/pages/findings.rs index e5a4d8b..da4c8e1 100644 --- a/compliance-dashboard/src/pages/findings.rs +++ b/compliance-dashboard/src/pages/findings.rs @@ -329,7 +329,7 @@ pub fn FindingsPage(target: String) -> Element { class: "finding-title-link", "{finding.title}" } - span { class: "finding-tool", "{finding.scanner}" } + span { class: "finding-tool", title: "{finding.scanner}", {tx::tool_name(&finding.scanner, lang)} } } td { {tx::scan_type(&finding.scan_type).get(lang)} } if let Some(names) = &target_names { -- 2.54.1