fix(anatomy): V1-2.2 owner arbitrations on SVG references and bytes
Refuse local references to ids a drawing does not define, scope canvas ids per view, upload every drawing in one stored form checked by the verdict and the preview, keep strict numeric rgb() colours, and commit real Inkscape 1.4.3 exports with their generator.
This commit is contained in:
1 parent
17d919971e
commit
e823655f09
31 files changed
+1362
-110
No files matched your search
@@ -26,6 +26,7 @@ use super::review::DigestError;
|
||||
use super::schema::{AnatomicalSheetDocument, LocalizedText};
|
||||
use super::verdict::{read_document, sha256_hex};
|
||||
use crate::anatomy::svg::processing_instructions;
|
||||
use crate::anatomy::svg::serialize::stored_form;
|
||||
use crate::domain::archive::SnapshotCaps;
|
||||
use crate::domain::js;
|
||||
|
||||
@@ -113,12 +114,17 @@ impl PreviewFailure {
|
||||
/// uploads of one editing session (each one at most 2 MiB, refused above).
|
||||
pub const MAX_HELD_DRAWINGS: usize = 16;
|
||||
|
||||
/// A drawing as the verdict would read it: a processing instruction refuses it here too.
|
||||
/// A drawing as the verdict would read it: a processing instruction or bytes outside the
|
||||
/// stored form refuse it here too.
|
||||
fn preview_drawing(text: &str) -> Drawing {
|
||||
if !processing_instructions(text).is_empty() {
|
||||
return Err("processing_instruction".to_owned());
|
||||
}
|
||||
read_drawing(text)
|
||||
let root = read_drawing(text)?;
|
||||
if stored_form(&root) != text {
|
||||
return Err("not_canonical".to_owned());
|
||||
}
|
||||
Ok(root)
|
||||
}
|
||||
|
||||
struct Asset {
|
||||
|
||||
@@ -25,6 +25,7 @@ use super::review::{Completeness, ElementChange, ReviewGroup, change_list};
|
||||
use super::schema::AnatomicalSheetDocument;
|
||||
use super::size::document_text_bytes;
|
||||
use super::validate::{SheetIssue, SheetIssueSeverity};
|
||||
use crate::anatomy::svg::serialize::stored_form;
|
||||
use crate::anatomy::svg::{processing_instructions, read_svg};
|
||||
use crate::domain::js::parse_json;
|
||||
|
||||
@@ -47,6 +48,7 @@ pub mod codes {
|
||||
pub const OBJECT_CONFLICT: &str = "verification.integrity.object_conflict";
|
||||
pub const SVG_REJECTED: &str = "verification.integrity.svg_rejected";
|
||||
pub const SVG_REMOVAL: &str = "verification.integrity.svg_removal";
|
||||
pub const SVG_NOT_CANONICAL: &str = "verification.integrity.svg_not_canonical";
|
||||
pub const FINGERPRINT: &str = "verification.integrity.fingerprint";
|
||||
}
|
||||
|
||||
@@ -101,6 +103,9 @@ pub enum DrawingResult {
|
||||
SvgRejected,
|
||||
/// The reader would take something out of it (names in `detail`); never repaired.
|
||||
SvgRemoval,
|
||||
/// Read with no removal but not in the stored form (`serialize::stored_form`): bytes the
|
||||
/// page's cleaning did not write (owner decision 2026-10-29).
|
||||
SvgNotCanonical,
|
||||
}
|
||||
|
||||
/// One drawing the views reference, as the verdict found it.
|
||||
@@ -340,6 +345,7 @@ fn check_bytes(row: &VerdictDrawing<'_>) -> (DrawingResult, Option<String>) {
|
||||
DrawingResult::SvgRejected,
|
||||
Some("processing_instruction".to_owned()),
|
||||
),
|
||||
Ok(read) if stored_form(&read.root) != text => (DrawingResult::SvgNotCanonical, None),
|
||||
Ok(_) => (DrawingResult::Ok, None),
|
||||
}
|
||||
}
|
||||
@@ -351,6 +357,7 @@ fn drawing_failures(drawings: &[CheckedDrawing]) -> Vec<&'static str> {
|
||||
(DrawingResult::HashMismatch, codes::OBJECT_CONFLICT),
|
||||
(DrawingResult::SvgRejected, codes::SVG_REJECTED),
|
||||
(DrawingResult::SvgRemoval, codes::SVG_REMOVAL),
|
||||
(DrawingResult::SvgNotCanonical, codes::SVG_NOT_CANONICAL),
|
||||
];
|
||||
order
|
||||
.into_iter()
|
||||
|
||||
Reference in new issue
Block a user