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
+11
-8
@@ -72,8 +72,8 @@ impl SheetHandle {
|
||||
#[wasm_bindgen]
|
||||
pub struct PreviewBuilder {
|
||||
drawings: Vec<PreviewDrawing>,
|
||||
/// A drawing was refused: the build answers `caps`.
|
||||
refused: bool,
|
||||
/// The cap a refused drawing passed: the build answers `caps` with it, as the core does.
|
||||
refused: Option<&'static str>,
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
@@ -82,16 +82,19 @@ impl PreviewBuilder {
|
||||
pub fn new() -> PreviewBuilder {
|
||||
PreviewBuilder {
|
||||
drawings: Vec::new(),
|
||||
refused: false,
|
||||
refused: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// `false` (nothing kept) past the preview's drawing count or a drawing over 2 MiB; the
|
||||
/// build then refuses with `caps` as the core does.
|
||||
pub fn add_drawing(&mut self, asset_id: &str, sha256: &str, bytes: &[u8]) -> bool {
|
||||
let full = self.drawings.len() >= MAX_HELD_DRAWINGS;
|
||||
if full || bytes.len() > SnapshotCaps::ASSET_BYTES {
|
||||
self.refused = true;
|
||||
if bytes.len() > SnapshotCaps::ASSET_BYTES {
|
||||
self.refused = Some("drawing_bytes");
|
||||
return false;
|
||||
}
|
||||
if self.drawings.len() >= MAX_HELD_DRAWINGS {
|
||||
self.refused = Some("drawings");
|
||||
return false;
|
||||
}
|
||||
self.drawings.push(PreviewDrawing {
|
||||
@@ -106,8 +109,8 @@ impl PreviewBuilder {
|
||||
/// `drawing_missing`, `drawing_hash_mismatch`, `fingerprint_mismatch`, `caps`, or
|
||||
/// `invalid_shape` / `invalid_json` for the input).
|
||||
pub fn build(self, input: &str) -> Result<PreviewSheet, JsError> {
|
||||
if self.refused {
|
||||
return Err(JsError::new("caps: drawings"));
|
||||
if let Some(cap) = self.refused {
|
||||
return Err(JsError::new(&format!("caps: {cap}")));
|
||||
}
|
||||
faunosteo_core::facade::load_preview(input, self.drawings)
|
||||
.map(|sheet| PreviewSheet { sheet })
|
||||
|
||||
Reference in new issue
Block a user