feat(report): embed the Xexéu logo and add a real TLP classification badge
Release / Plan (reuse the published image?) (push) Successful in 5s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and clippy (push) Failing after 10s
CI / Tests (Linux) (push) Successful in 1m22s
CI / Dependency audit (push) Failing after 12s
Release / ci (push) Failing after 1m44s
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Skipped
Release / Gitea release (push) Skipped
Release / Plan (reuse the published image?) (push) Successful in 5s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and clippy (push) Failing after 10s
CI / Tests (Linux) (push) Successful in 1m22s
CI / Dependency audit (push) Failing after 12s
Release / ci (push) Failing after 1m44s
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Skipped
Release / Gitea release (push) Skipped
The executive report had no logo at all (just plain "XEXÉU" text) and its "CONFIDENCIAL" badge was project-invented wording, not a real classification taxonomy. Embeds the logo as a base64 data URI (mirrors Sabiá's report.rs, so the report still renders correctly as a standalone offline HTML export) and replaces the badge with FIRST.org's actual TLP 2.0 labels/colors (TlpLevel enum, defaulting to TLP:AMBER — a vulnerability report naming real exposed hosts is sensitive by nature). Applied on both the cover and the per-page running header. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2298117c47
commit
b78b4ee2fb
1 file changed
+113
-6
@@ -21,10 +21,56 @@ pub struct ExecutiveReport {
|
||||
pub emitted_at: DateTime<Utc>,
|
||||
/// Summary of targets and vulnerability statistics.
|
||||
pub scope_summary: ScopeSummary,
|
||||
/// Traffic Light Protocol (FIRST.org TLP 2.0) sharing classification for
|
||||
/// this document. A vulnerability report is sensitive by nature, so it
|
||||
/// defaults to [`TlpLevel::Amber`] (limited disclosure to the
|
||||
/// organization and need-to-know) rather than an unmarked document.
|
||||
pub tlp: TlpLevel,
|
||||
/// Report sections.
|
||||
pub sections: Vec<ReportSection>,
|
||||
}
|
||||
|
||||
/// Traffic Light Protocol sharing classification, per
|
||||
/// <https://www.first.org/tlp/>. Controls who the document may be shared
|
||||
/// with — independent of, and not a substitute for, the "authorized use"
|
||||
/// notice (which is about scanning authorization, not document handling).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum TlpLevel {
|
||||
/// Not for disclosure, restricted to named recipients only.
|
||||
Red,
|
||||
/// Limited disclosure, restricted to the organization and need-to-know —
|
||||
/// the default for a vulnerability report naming real exposed hosts.
|
||||
Amber,
|
||||
/// Limited disclosure, restricted to the community.
|
||||
Green,
|
||||
/// Disclosure is not limited.
|
||||
Clear,
|
||||
}
|
||||
|
||||
impl TlpLevel {
|
||||
/// The label printed on the cover badge, e.g. `TLP:AMBER`.
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
TlpLevel::Red => "TLP:RED",
|
||||
TlpLevel::Amber => "TLP:AMBER",
|
||||
TlpLevel::Green => "TLP:GREEN",
|
||||
TlpLevel::Clear => "TLP:CLEAR",
|
||||
}
|
||||
}
|
||||
|
||||
/// The official TLP color (FIRST.org brand colors) as a CSS hex value,
|
||||
/// used for the badge's border/text so the classification is
|
||||
/// recognizable at a glance, not just by the text label.
|
||||
pub fn color(self) -> &'static str {
|
||||
match self {
|
||||
TlpLevel::Red => "#FF2B2B",
|
||||
TlpLevel::Amber => "#FFC000",
|
||||
TlpLevel::Green => "#33FF00",
|
||||
TlpLevel::Clear => "#FFFFFF",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Aggregated metrics over the audited scope.
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
pub struct ScopeSummary {
|
||||
@@ -477,6 +523,7 @@ impl ExecutiveReport {
|
||||
),
|
||||
emitted_at: now,
|
||||
scope_summary,
|
||||
tlp: TlpLevel::Amber,
|
||||
sections: vec![
|
||||
narrative_section,
|
||||
kpi_section,
|
||||
@@ -503,7 +550,7 @@ impl ExecutiveReport {
|
||||
"<script src=\"/paged.polyfill.js\"></script>\n<script>window.Paged || document.write('<script src=\"https://unpkg.com/pagedjs/dist/paged.polyfill.js\"><\\/script>')</script>\n",
|
||||
);
|
||||
html.push_str("<style>\n");
|
||||
html.push_str(REPORT_CSS);
|
||||
html.push_str(&REPORT_CSS.replace("XEXEU_REPORT_TLP_MARKER", self.tlp.label()));
|
||||
html.push_str("</style>\n</head>\n<body>\n");
|
||||
|
||||
// 1. Cover Page
|
||||
@@ -517,10 +564,17 @@ impl ExecutiveReport {
|
||||
|
||||
html.push_str("<div class=\"cover\">\n");
|
||||
html.push_str(" <div class=\"cover-top\">\n");
|
||||
html.push_str(" <div class=\"cover-brand\">XEXÉU</div>\n");
|
||||
html.push_str(
|
||||
" <div class=\"cover-classification\">USO AUTORIZADO · CONFIDENCIAL</div>\n",
|
||||
);
|
||||
html.push_str(" <div class=\"cover-brand\"><img class=\"cover-logo\" src=\"");
|
||||
html.push_str(&logo_data_uri());
|
||||
html.push_str("\" alt=\"\">XEXÉU</div>\n");
|
||||
html.push_str(" <div class=\"cover-badges\">\n");
|
||||
html.push_str(&format!(
|
||||
" <div class=\"cover-tlp\" style=\"color:{0};border-color:{0}\">{1}</div>\n",
|
||||
self.tlp.color(),
|
||||
self.tlp.label()
|
||||
));
|
||||
html.push_str(" <div class=\"cover-classification\">USO AUTORIZADO</div>\n");
|
||||
html.push_str(" </div>\n");
|
||||
html.push_str(" </div>\n");
|
||||
html.push_str(
|
||||
" <div class=\"cover-eyebrow\">CIBERFAUNA · AUDITORIA CONTÍNUA DE SEGURANÇA</div>\n",
|
||||
@@ -773,6 +827,37 @@ impl ExecutiveReport {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Xexéu logo, embedded so the report renders identically whether it's
|
||||
/// viewed live from `/relatorio` or saved as a standalone offline HTML file
|
||||
/// (same reasoning as `Sabiá/crates/sabia-core/src/report.rs`, which this
|
||||
/// mirrors — a `src="/logo.png"` reference would 404 once the file is saved
|
||||
/// outside the server's reach).
|
||||
const LOGO_PNG: &[u8] = include_bytes!("../../../logo.png");
|
||||
|
||||
const B64: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
/// Encodes `bytes` as a `data:image/png;base64,...` URI.
|
||||
fn logo_data_uri() -> String {
|
||||
let mut out = String::with_capacity(LOGO_PNG.len().div_ceil(3) * 4 + 22);
|
||||
out.push_str("data:image/png;base64,");
|
||||
for chunk in LOGO_PNG.chunks(3) {
|
||||
let b0 = chunk[0];
|
||||
let b1 = chunk.get(1).copied();
|
||||
let b2 = chunk.get(2).copied();
|
||||
out.push(B64[(b0 >> 2) as usize] as char);
|
||||
out.push(B64[(((b0 & 0b11) << 4) | (b1.unwrap_or(0) >> 4)) as usize] as char);
|
||||
out.push(match b1 {
|
||||
Some(b1) => B64[(((b1 & 0b1111) << 2) | (b2.unwrap_or(0) >> 6)) as usize] as char,
|
||||
None => '=',
|
||||
});
|
||||
out.push(match b2 {
|
||||
Some(b2) => B64[(b2 & 0b111111) as usize] as char,
|
||||
None => '=',
|
||||
});
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
fn html_escape(raw: &str) -> String {
|
||||
raw.replace('&', "&")
|
||||
.replace('<', "<")
|
||||
@@ -844,7 +929,7 @@ body {
|
||||
padding-bottom: 4mm;
|
||||
}
|
||||
@top-right {
|
||||
content: "USO AUTORIZADO · CONFIDENCIAL";
|
||||
content: "XEXEU_REPORT_TLP_MARKER · USO AUTORIZADO";
|
||||
font-family: var(--font-mono);
|
||||
font-size: 7pt;
|
||||
font-weight: 700;
|
||||
@@ -904,12 +989,34 @@ body {
|
||||
padding-bottom: 5mm;
|
||||
}
|
||||
.cover-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 3mm;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 16pt;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.18em;
|
||||
color: var(--accent);
|
||||
}
|
||||
.cover-logo {
|
||||
width: 9mm;
|
||||
height: 9mm;
|
||||
object-fit: contain;
|
||||
}
|
||||
.cover-badges {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2.5mm;
|
||||
}
|
||||
.cover-tlp {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 8pt;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.1em;
|
||||
border: 1.5px solid;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.cover-classification {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 8pt;
|
||||
|
||||
Reference in new issue
Block a user