fix(anatomy): V1-2.2 review findings, PIs and HTML refused, bounds

Security audit (PASS, 2 MEDIUM, 2 LOW) and verifier (ECARTS 6) on
741c25c: processing instructions and HTML fetchers refused, active
content under a long title classified, linear review groups, full
fixpoint check, bounded preview drawings, missing cap fixtures and
property checks, record wordings.
This commit is contained in:
bchanot committed 2026-10-29 13:38:33 +01:00
1 parent 741c25c464
commit 8294d5471c
15 files changed
+448 -72

No files matched your search

+43 -1
View File
@@ -110,7 +110,7 @@ fn a_clean_sheet_passes_bound_to_its_round() {
let keys: Vec<&str> = verdict.groups.iter().map(|g| g.key.as_str()).collect();
assert_eq!(keys, ["general", "view:main", "zone:z1"]);
assert!(
verdict.groups.iter().skip(1).all(|g| !g.coverable),
verdict.groups[1..].iter().all(|g| !g.coverable),
"to_confirm left"
);
assert!(verdict.changes.is_none());
@@ -540,3 +540,45 @@ fn a_document_at_every_cap_is_verified_in_time() {
"the core's share of the 120 s budget"
);
}
#[test]
fn every_cap_holds_at_cap_minus_one_and_cap_and_fails_one_over() {
use faunosteo_core::domain::sheet::AnatomicalSheetDocument;
use faunosteo_core::domain::sheet::caps::caps_report;
const MIB: u64 = 1024 * 1024;
let typed =
|doc: &Value| -> AnatomicalSheetDocument { serde_json::from_value(doc.clone()).unwrap() };
let names = |doc: &AnatomicalSheetDocument, sizes: &[u64]| -> Vec<&'static str> {
caps_report(doc, 0, sizes)
.exceeded
.iter()
.map(|c| c.as_str())
.collect()
};
let base = typed(&document());
for (sizes, expected) in [
(vec![1; 3], vec![]),
(vec![1; 4], vec![]),
(vec![1; 5], vec!["drawings"]),
(vec![2 * MIB - 1], vec![]),
(vec![2 * MIB], vec![]),
(vec![2 * MIB + 1], vec!["drawing_bytes"]),
(vec![2 * MIB, 2 * MIB, 2 * MIB - 1], vec![]),
(vec![2 * MIB, 2 * MIB, 2 * MIB], vec![]),
(
vec![2 * MIB, 2 * MIB, 2 * MIB, 1],
vec!["drawings_total_bytes"],
),
] {
assert_eq!(names(&base, &sizes), expected, "{sizes:?}");
}
for (count, expected) in [(63, vec![]), (64, vec![]), (65, vec!["views"])] {
let mut doc = document();
let extra = (1..count).map(|i| {
json!({ "id": format!("d{i}"), "kind": "detail", "name": name("D"), "svg_asset_id": null,
"view_box": { "min_x": 0, "min_y": 0, "width": 1, "height": 1 }, "parent_view_id": "main" })
});
doc["views"].as_array_mut().unwrap().extend(extra);
assert_eq!(names(&typed(&doc), &[1]), expected, "{count} views");
}
}