fix(agent): CVE tickets name the CRA requirements, not their ids

The CRA section of a CVE issue listed cra-ai-22 and cra-ai-33 with the
catalog titles; it now reads like the finding issues, by the requirement
names in both languages, through the same helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-11-27 23:00:03 +01:00
1 parent b94c490956
commit 85cf503d85
2 files changed
+6 -10

No files matched your search

+4 -9
View File
@@ -456,14 +456,8 @@ fn issue_body(alert: &CveAlert, severity: &str, target_id: &str, dashboard: &str
));
}
body.push_str("\n### CRA\n\n");
let map = control_map::ControlMap::cra().ok();
for id in CVE_CONTROLS {
let title = map
.as_ref()
.and_then(|m| m.coverage(id))
.map(|c| c.title.clone())
.unwrap_or_default();
body.push_str(&format!("- {id} — {title} (Annex I)\n"));
for requirement in crate::pipeline::issue_creation::cra_requirements(&CVE_CONTROLS) {
body.push_str(&format!("- {requirement}\n"));
}
let dashboard = dashboard.trim_end_matches('/');
if dashboard.starts_with("https://") {
@@ -763,7 +757,8 @@ mod tests {
// pruefwerk (1), cra:annex-i (2), severity:high (4), cve (7).
assert!(calls[0].ends_with("labels=[1,2,4,7]"), "{}", calls[0]);
assert!(calls[1].contains("Fixed in: 4.9.2"));
assert!(calls[1].contains("cra-ai-22"));
assert!(calls[1].contains("Bekannte Schwachstellen in Komponenten"));
assert!(!calls[1].contains("cra-ai-22"));
assert!(calls[1].contains("https://pruefwerk.example/targets/target-1"));
}
@@ -690,9 +690,10 @@ pub(super) fn format_issue_body(finding: &Finding) -> String {
/// `control_refs`, by the name a customer reads in both languages
/// (`Keine Standardpasswörter / No default passwords (Annex I)`). An id
/// outside the 40 requirements stays as it is.
fn cra_requirements(control_refs: &[String]) -> Vec<String> {
pub(crate) fn cra_requirements<S: AsRef<str>>(control_refs: &[S]) -> Vec<String> {
control_refs
.iter()
.map(AsRef::as_ref)
.filter(|id| id.starts_with("cra-"))
.map(|id| match compliance_core::cra_requirements::name(id) {
Some(name) => format!("{} / {} (Annex I)", name.de, name.en),