Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇
Go aicertificationcloud-engineeringcybercybersecuritycybersecurity-analystcybersecurity-certificationcybersecurity-certificationscybersecurity-educationcybersecurity-jobscybersecurity-portfoliocybersecurity-projectscybersecurity-toolsgrchackinglearningpentestingproject-repositoryprojetcspython
// ©AngelaMos | 2026
// rendering.rs
use lisdex_core::campaign::{CampaignId, TreeProvenance};
use lisdex_core::crash::Crash;
use lisdex_core::dedup;
use lisdex_report::advisory::{Advisory, OPERATOR_INPUTS};
use lisdex_report::json::{self, GHSA_ECOSYSTEM_FOR_C_LIBRARIES};
use lisdex_report::markdown;
const CAMPAIGN: CampaignId = CampaignId(1);
const REAL_HEAP_WRITE: &str = "\
=================================================================
==53767==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7bd6bfde0020 at pc 0x558474e40fd9
WRITE of size 32 at 0x7bd6bfde0020 thread T0
#0 0x558474e40fd8 in png_handle_iCCP /src/libpng/pngrutil.c:1447:5
#1 0x558474e41111 in png_read_info /src/libpng/pngread.c:160:10
SUMMARY: AddressSanitizer: heap-buffer-overflow (/out/harness+0xcdfd8) in png_handle_iCCP
";
const CANARY_CRASH: &str = "\
=================================================================
==29092==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000071a4 (pc 0x7fa6518a053b bp 0x1 sp 0x2 T0)
==29092==The signal is caused by a READ memory access.
#0 0x7fa6518a053b in kill (/lib/x86_64-linux-gnu/libc.so.6+0x4553b)
#1 0x55a5aee02220 in magma_log /opt/magma/magma/src/canary.c:92:5
#2 0x55a5aee68dae in MAGMA_png_handle_PLTE /opt/magma-work/libpng/repo/pngrutil.c:992:4
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x4553b) in kill
";
const UBSAN_REPORT: &str = "\
pngrutil.c:1204:7: runtime error: left shift of negative value -1
#0 0x55a in png_do_read_transform pngrtran.c:1204:7
";
fn advisory(report: &str) -> Advisory {
drafted(report, TreeProvenance::Field)
}
fn drafted(report: &str, tree: TreeProvenance) -> Advisory {
let crashes: Vec<Crash> = (0..44)
.map(|_| Crash::from_report(CAMPAIGN, b"reproducer-bytes".to_vec(), report))
.collect();
let grouping = dedup::group_crashes(&crashes);
Advisory::draft("libpng", &grouping.groups()[0], tree).expect("fixture must draft")
}
#[test]
fn every_field_lisdex_declines_appears_in_the_rendered_advisory_with_its_reason() {
let rendered = markdown::render(&advisory(REAL_HEAP_WRITE), None);
for input in OPERATOR_INPUTS {
assert!(
rendered.contains(input.why()),
"{} is declined by the model but its reason never reaches the page, so a reader sees a missing field with no explanation and cannot tell a deliberate refusal from an oversight",
input.field()
);
}
}
#[test]
fn the_advisory_never_states_a_version_range_or_a_cvss_vector() {
let rendered = markdown::render(&advisory(REAL_HEAP_WRITE), None);
assert!(
!rendered.contains("CVSS:3.1/") && !rendered.contains("CVSS:4.0/"),
"a CVSS vector in this document would be derived from the crash class alone, which is a guess wearing a number"
);
assert!(
rendered.contains("### Affected versions\n\nNOT ESTABLISHED"),
"the version heading must survive with an explicit refusal in it; dropping the heading entirely would make the advisory look complete when the field is simply unknown"
);
}
#[test]
fn a_planted_benchmark_finding_is_rendered_with_a_refusal_and_no_filing_instructions() {
let rendered = markdown::render(&advisory(CANARY_CRASH), None);
assert!(
rendered.contains("DO NOT FILE THIS ADVISORY"),
"the refusal has to be the first thing the reader meets, not a footnote"
);
assert!(
!rendered.contains("Anyone with admin permissions"),
"an advisory for a deliberately planted bug must not carry instructions for filing it"
);
}
#[test]
fn a_tree_refusal_does_not_claim_a_call_stack_it_cannot_show() {
let from_tree = drafted(REAL_HEAP_WRITE, TreeProvenance::Benchmark);
let rendered = markdown::render(&from_tree, None);
assert!(rendered.contains("DO NOT FILE THIS ADVISORY"));
assert!(
!rendered.contains("benchmark instrumentation in its call stack"),
"this crash was refused on the target lisdex measured, and its stack carries no benchmark frame; saying otherwise is a claim the evidence does not support"
);
assert!(
rendered.contains("forward-port real historical CVEs"),
"the reader has to be told the actual reason, or a refusal they can see is unfounded reads as a bug in lisdex"
);
let from_frames = markdown::render(&advisory(CANARY_CRASH), None);
assert!(
from_frames.contains("benchmark instrumentation in its call stack"),
"and the stack-evidence wording must survive for the case where the stack really does show it"
);
}
#[test]
fn a_real_finding_is_rendered_with_the_filing_route_that_actually_applies() {
let rendered = markdown::render(&advisory(REAL_HEAP_WRITE), None);
assert!(!rendered.contains("DO NOT FILE THIS ADVISORY"));
assert!(
rendered.contains("There is no C or C++ ecosystem"),
"every target lisdex fuzzes is a C or C++ library, and GitHub's ecosystem field is required with no value for one; an operator who does not know this cannot complete the form"
);
assert!(
rendered.contains("cannot request a CVE without the maintainer"),
"requesting a CVE needs admin on the advisory, which a reporting researcher is never granted, and an advisory that implied otherwise would send them down a route that does not exist"
);
}
#[test]
fn the_sanitizer_report_is_reproduced_verbatim_as_the_evidence() {
let rendered = markdown::render(&advisory(REAL_HEAP_WRITE), None);
assert!(
rendered.contains(REAL_HEAP_WRITE.trim_end()),
"the report is the evidence; an edited or reflowed copy is not the thing the sanitizer said"
);
}
#[test]
fn an_unassessed_severity_is_flagged_rather_than_presented_as_a_low_one() {
let rendered = markdown::render(&advisory(UBSAN_REPORT), None);
assert!(
rendered.contains("Severity is unassessed for this finding"),
"UNDEFINED is the tier lisdex uses when it has no labelled corpus (B91); rendering it beside the other tiers with no caveat reads as an assessment that the finding is unremarkable"
);
assert!(
rendered.contains("No CWE is named"),
"the same gap applies to naming a weakness for it"
);
}
#[test]
fn the_json_leaves_every_unestablished_field_null_instead_of_inventing_one() {
let rendered = json::render(&advisory(REAL_HEAP_WRITE));
let ghsa = &rendered["ghsa"];
for field in [
"vulnerable_version_range",
"patched_versions",
"cvss_vector_string",
"cve_id",
] {
assert!(
ghsa[field].is_null(),
"{field} is a required key in GitHub's advisory schema whose type is string-or-null, so null is a valid record meaning 'not established' and any value lisdex put there would be fabricated"
);
}
assert_eq!(
ghsa["ecosystem"], GHSA_ECOSYSTEM_FOR_C_LIBRARIES,
"GitHub's ecosystem enum has no C or C++ member, so a C library is filed under other"
);
}
#[test]
fn the_json_carries_the_same_refusals_the_page_does() {
let rendered = json::render(&advisory(REAL_HEAP_WRITE));
let declined = rendered["declined"]
.as_array()
.expect("declined must be an array");
assert_eq!(
declined.len(),
OPERATOR_INPUTS.len(),
"a consumer reading the JSON must see the same gaps a human reading the page sees, or the two renderings disagree about what lisdex claims to know"
);
for input in OPERATOR_INPUTS {
assert!(
declined
.iter()
.any(|entry| entry["field"] == input.field() && entry["reason"] == input.why()),
"{} is missing from the machine-readable refusals",
input.field()
);
}
}
#[test]
fn the_json_marks_a_planted_benchmark_finding_undisclosable() {
let rendered = json::render(&advisory(CANARY_CRASH));
assert_eq!(rendered["disclosable"], false);
assert_eq!(rendered["provenance"], "synthetic_benchmark");
let real = json::render(&advisory(REAL_HEAP_WRITE));
assert_eq!(
real["disclosable"], true,
"marking every finding undisclosable would make the mark meaningless"
);
assert_eq!(real["provenance"], "field");
}
#[test]
fn the_json_renders_as_a_string_a_consumer_can_parse_back() {
let text = json::render_string(&advisory(REAL_HEAP_WRITE));
let parsed: serde_json::Value =
serde_json::from_str(&text).expect("the emitted document must be valid JSON");
assert_eq!(parsed, json::render(&advisory(REAL_HEAP_WRITE)));
}