feat(dashboard): the CSAF draft's TLP label as a coloured badge with its meaning
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 10m36s

The VEX panel said "TLP:AMBER" only inside the hint sentence. It now shows
the label as a badge (AMBER amber, RED red, GREEN green, CLEAR/WHITE
neutral, reusing the existing badge classes) with the FIRST TLP 2.0
sharing rule as its tooltip, in German and English.

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:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-10-08 23:33:43 +02:00
1 parent dd70ec753c
commit 8d26845355
4 files changed
+83 -8

No files matched your search

@@ -372,11 +372,45 @@ fn CsafExport(target_id: String) -> Element {
Icon { icon: BsDownload, width: 14, height: 14 }
{tx::EXPORT_CSAF.get(lang)}
}
p { class: "target-muted", {tx::CSAF_HINT.get(lang)} }
p { class: "target-muted",
{tx::CSAF_TLP.get(lang)}
" "
TlpBadge { label: CSAF_DRAFT_TLP }
". "
{tx::CSAF_HINT.get(lang)}
}
}
}
}
/// The TLP label of the CSAF draft, as `compliance_core::csaf_docs` writes it
/// into `document.distribution.tlp`.
const CSAF_DRAFT_TLP: &str = "AMBER";
/// The badge class and the sharing rule of a TLP label (TLP 1.0's WHITE is
/// TLP 2.0's CLEAR), or `None` for a label TLP does not define.
fn tlp_badge(label: &str) -> Option<(&'static str, Text)> {
match label {
"RED" => Some(("badge badge-danger", tx::TLP_RED)),
"AMBER" => Some(("badge badge-medium", tx::TLP_AMBER)),
"GREEN" => Some(("badge badge-success", tx::TLP_GREEN)),
"CLEAR" | "WHITE" => Some(("badge badge-neutral", tx::TLP_CLEAR)),
_ => None,
}
}
/// A TLP label as a coloured badge whose tooltip says what it allows.
#[component]
fn TlpBadge(label: String) -> Element {
let lang = use_lang()();
let badge = tlp_badge(&label);
let class = badge.map_or("badge", |(class, _)| class);
let meaning = badge.map_or("", |(_, meaning)| meaning.get(lang));
rsx! {
span { class, title: meaning, "TLP:{label}" }
}
}
/// The statement editor for one alert, starting from its current statement.
/// `on_close` gets whether a statement was saved.
#[component]
@@ -488,6 +522,21 @@ fn VexEditor(alert: CveAlert, on_close: EventHandler<bool>) -> Element {
mod tests {
use super::*;
#[test]
fn each_tlp_label_has_its_colour_and_sharing_rule() {
assert_eq!(
tlp_badge("AMBER"),
Some(("badge badge-medium", tx::TLP_AMBER))
);
assert_eq!(tlp_badge("RED"), Some(("badge badge-danger", tx::TLP_RED)));
assert_eq!(
tlp_badge("GREEN"),
Some(("badge badge-success", tx::TLP_GREEN))
);
assert_eq!(tlp_badge("WHITE"), tlp_badge("CLEAR"));
assert_eq!(tlp_badge("PURPLE"), None);
}
fn statement(status: VexStatus) -> VexStatementDto {
VexStatementDto {
status,
+25 -5
View File
@@ -2322,12 +2322,32 @@ pub mod vex {
de: "Web-Adresse des Herausgebers (für CSAF)",
en: "Publisher web address (for CSAF)",
};
pub const CSAF_TLP: Text = Text {
de: "Der CSAF-Entwurf ist markiert als",
en: "The CSAF draft is marked",
};
pub const CSAF_HINT: Text = Text {
de: "Der CSAF-Entwurf ist als TLP:AMBER markiert. Prüfen Sie Herausgeber und \
Aussagen, bevor Sie ihn veröffentlichen. Ohne Web-Adresse enthält er einen \
Platzhalter.",
en: "The CSAF draft is marked TLP:AMBER. Check the publisher and the statements \
before you publish it. Without a web address it holds a placeholder.",
de: "Prüfen Sie Herausgeber und Aussagen, bevor Sie ihn veröffentlichen. Ohne \
Web-Adresse enthält er einen Platzhalter.",
en: "Check the publisher and the statements before you publish it. Without a web \
address it holds a placeholder.",
};
// What each Traffic Light Protocol label allows (FIRST TLP 2.0).
pub const TLP_RED: Text = Text {
de: "Nur für die einzelnen Empfänger, keine Weitergabe",
en: "For the individual recipients only, no further disclosure",
};
pub const TLP_AMBER: Text = Text {
de: "Weitergabe nur intern und an Kunden, die es wissen müssen",
en: "Share only within your organisation and with clients who need to know",
};
pub const TLP_GREEN: Text = Text {
de: "Weitergabe innerhalb der eigenen Community, nicht öffentlich",
en: "Share within your community, not publicly",
};
pub const TLP_CLEAR: Text = Text {
de: "Weitergabe ohne Einschränkung, öffentlich",
en: "No limit on disclosure, public",
};
pub const EXPORT_FAILED: Text = Text {
de: "Der VEX-Export ist fehlgeschlagen",
+4 -1
View File
@@ -67,7 +67,10 @@ The draft
remediation, "Not affected" with its justification and statement, "Under
investigation" and "Fixed";
- is marked as a draft (`draft`) and **TLP:AMBER**, with the note "Draft, not
published: check publisher and statements before release.";
published: check publisher and statements before release." (shown below
the download button as an amber badge whose tooltip says what TLP:AMBER
allows: share only within your organisation and with clients who need to
know);
- is tagged with the UI's language (`lang`).
The publisher is your workspace. Enter your company's web address before
+4 -1
View File
@@ -70,7 +70,10 @@ Schwachstellen veröffentlichen. Der Entwurf
Abhilfe, „Nicht betroffen“ mit Begründung und Freitext, „In Prüfung“ und
„Behoben“;
- ist als Entwurf (`draft`) und **TLP:AMBER** markiert und trägt den Hinweis
„Draft, not published: check publisher and statements before release.“;
„Draft, not published: check publisher and statements before release.“
(unter dem Download-Knopf als bernsteinfarbenes Abzeichen; der Tooltip
sagt, was TLP:AMBER erlaubt: Weitergabe nur intern und an Kunden, die es
wissen müssen);
- ist in der Sprache der Oberfläche ausgezeichnet (`lang`).
Herausgeber ist Ihr Arbeitsbereich. Tragen Sie vor dem Herunterladen die