fix(domain): V1-2.2 second review round, linear walks, bounds, CSS loaders
Verifier ECARTS(3) and security PASS on 8294d54: one indexed walk per
view chain in sheet.edit, a set for referenced drawings, released
preview parses, xml:base and CSS loaders refused, fail-closed PI scan,
PI drawings rejected by the preview, the builder naming its cap.
This commit is contained in:
1 parent
8294d5471c
commit
ca31b787b6
13 files changed
+201
-36
No files matched your search
@@ -391,3 +391,48 @@ fn a_preview_holds_a_bounded_number_of_bounded_drawings() {
|
||||
);
|
||||
assert_eq!(draft.drawing_reads(), 1, "the same bytes are read once");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_replaced_asset_releases_its_parse_and_a_pi_drawing_shows_rejected() {
|
||||
let mut draft = PreviewSheet::load(
|
||||
input(PreviewStatus::Draft, document_text(), None),
|
||||
vec![horse_drawing()],
|
||||
)
|
||||
.unwrap();
|
||||
for i in 0..40 {
|
||||
let svg = format!(r#"<svg xmlns="http://www.w3.org/2000/svg"><path d="M0 0h{i}"/></svg>"#)
|
||||
.into_bytes();
|
||||
let sha = faunosteo_core::domain::sheet::verdict::sha256_hex(&svg);
|
||||
draft
|
||||
.add_drawing(PreviewDrawing {
|
||||
asset_id: "same-asset".into(),
|
||||
sha256: sha,
|
||||
bytes: svg,
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
assert_eq!(
|
||||
draft.held_parses(),
|
||||
2,
|
||||
"the horse and the last bytes of the re-added asset"
|
||||
);
|
||||
let pi = br#"<?xml-stylesheet href="https://e/x.xsl"?><svg xmlns="http://www.w3.org/2000/svg"><path d="M0 0h1"/></svg>"#.to_vec();
|
||||
let sha = faunosteo_core::domain::sheet::verdict::sha256_hex(&pi);
|
||||
let mut doc = parse_json(&document_text()).unwrap();
|
||||
doc["views"][0]["svg_asset_id"] = json!("33333333-0000-4000-8000-000000000001");
|
||||
let preview = PreviewSheet::load(
|
||||
input(PreviewStatus::Draft, doc.to_string(), None),
|
||||
vec![PreviewDrawing {
|
||||
asset_id: "33333333-0000-4000-8000-000000000001".into(),
|
||||
sha256: sha,
|
||||
bytes: pi,
|
||||
}],
|
||||
)
|
||||
.unwrap();
|
||||
let state = state(&preview);
|
||||
assert_eq!(state.drawings[0].state, PreviewDrawingStatus::Rejected);
|
||||
assert_eq!(
|
||||
state.drawings[0].detail.as_deref(),
|
||||
Some("processing_instruction")
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user