Security review BLOCK(1): url(#%61) passed the dangling check and the per-view scoping and resolved in browsers. One strict reading now, other spellings are active content; glued names are other functions; the composer refuses an unscoped reference; owner export procedure.
7.6 KiB
7.6 KiB
Contract: V1-2.2 core (verdict, PreviewSheet, edit primitives, SVG cleaning)
Source of truth: docs/development/V1-2_ANATOMICAL_SHEETS.md (the "V1-2 contract"), §16.3 for the
step, with the sections it cites. Owner brief 2026-10-29 « Autorisation de démarrer V1-2.2 ». Base
commit ac71c5b (V1-2.1 verified by the owner). Diff under review: ac71c5b..HEAD on
feature/v1-2-anatomical-sheets.
Scope (§16.3)
- The verdict function: strict parse, issues, caps, drawings, fingerprint, completeness, groups, digests, removal groups, change list (§6.3, §6.4, §6.5, §6.6, §6.7).
PreviewSheetas the catalogue, preview and editor handle, withview.canvason it (§8.1, §10).sheet.editprimitives with the status rules of §6.6;dependents(§8.1).- SVG classification and cleaning (§9.2).
- Application changes limited to the wasm facade and the ts-rs types; no SQL change; no screen.
Acceptance criteria (§16.3, §15 « Core »)
- A1 Hash and fingerprint mismatches refused by
PreviewSheet. - A2 The equine draft previews with the same index and fingerprint as from the bundle.
- A3 An invalid draft draws with its issues.
- A4 A document replacement redraws without re-reading the drawings.
- A5 The groups of a derived version that deletes a zone include its removal group.
- A6 Vector-tool exports cleaned and hostile files refused (see owner decision D1 below).
- A7 Every edit primitive outputs a strictly parseable document, keeps existing keys and applies the status rules (property tests).
- A8 Groups, digests and removal groups; the change list; the verdict function tested.
- A9 SVG classification and cleaning tested on committed vector-tool exports and the hostile corpus; the cleaning fixpoint proven by a property test.
- A10 Caps fixtures at cap − 1, cap, cap + 1 and with astral characters.
- A11 The document size computed in the measure of §12.2 (
octet_length(content::text), the jsonb text form, neverJSON.stringify), reusing the pgTAP 017 vectors. - A12 Wasm facade and ts-rs types; the N-1 reader untouched; the frozen oracles green.
- A13 None of the protected readers is modified:
crates/core/src/domain/{archive/read,report/rebase, report/read,session}.rs,crates/core/src/pdf/{read,json_js,import}.rs, the frozenpackages/core-wasm/tests/n-1copies. Any change there is a deviation. - A14 The verdict is never computed or accepted from a page (O15): no RPC or browser path makes a verdict authoritative.
- A15 Verdict shape compatible with what the M5 SQL (
supabase/migrations/20261028110000_sheet_review_workflow.sql) reads:verdict->'groups'items{key, digest, coverable},verdict->'drawings'items{asset_id, sha256},verdict->>'fingerprint'. - A16 No DEV operation, no SQL migration, no merge, no change outside the scope above beyond the documents that record it.
Owner decisions taken during the step (2026-10-29, contract §17.4)
- D1 The editors' exports (Inkscape, Illustrator, Figma, Affinity) are supplied by the owner later,
under
crates/core/tests/fixtures/svg/exports/owner/; the exports of tools installed on the development machine (cairo, ImageMagick) are committed meanwhile. A6 is therefore partially met until the owner's files arrive; the report must say so. - D2 A document that does not read strictly fails as
verification.integrity.document(§6.5); the 19 rule errors areverification.validation.rules. - D3
PreviewSheetof a draft reports caps excess and missing drawings; a published or deprecated version refuses them (caps,drawing_missing); hash mismatch and an unreadable document refuse every mode.
Where to look
- Core:
crates/core/src/domain/sheet/{size,keys,caps,review,report,verdict,preview,edit}.rs,crates/core/src/anatomy/svg/{clean,sanitize,mod}.rs,crates/core/src/{ops,facade}.rs. - Wasm:
crates/wasm/src/lib.rs;packages/core-wasm/{src,types,tests/preview.test.ts}. - Tests:
crates/core/tests/{sheet_size,sheet_review,sheet_verdict,sheet_preview,sheet_edit,svg_clean}.rs, oraclecrates/core/tests/oracles/v1-2-2/, fixturescrates/core/tests/fixtures/svg/exports/. - Records:
docs/development/RUST.md§12, the contract's §6.7, §9.2, §10, §17.4.
Commands
pnpm rust:check(fmt, clippy, all core feature suites, ts-rs export, cargo deny).pnpm wasm:buildthenpnpm --filter @faunosteo/core-wasm test:run(the size budget is 600 000 B).cargo test -p faunosteo-core --test sheet_verdict(and the other five suites).
Owner arbitrations at the checkpoint (2026-10-29, contract §17.4, last six rows)
Brief « V1-2.2 : arbitrages du propriétaire et finalisation » on 17d9199. Diff under review for this round:
17d9199..HEAD. The criteria above still hold; these are added.
- B1 A local reference (
href,xlink:href,url(#…)) to an id the drawing does not define is refused (dangling_reference) byread_svg(stored drawings, verdict, preview, PDF snapshot gate) and byclean_svg, the latter only after active content is classified. Valid internal references keep working. - B2
view.canvas(onLoadedSheetandPreviewSheet) scopes every id and local reference of the drawing to its view (fv.<view>.); two canvases inlined in one page never resolve into each other; composition deterministic; stored bytes, sha256, fingerprints, archive snapshots and PDF views untouched. Tests: valid, absent, same ids in two views, cross-view attempt, many references to one id, repeated composition (tests/svg_scope.rs). - B3 Every accepted file (clean or cleanable) is uploaded in the stored form (
serialize::stored_form); verdict (verification.integrity.svg_not_canonical), preview (not_canonical) and the upload tool refuse another form; the equine drawing's sha2560ea5202f…and the fingerprint12d78872…unchanged. - B4 Strict numeric
rgb()/rgba()kept;url(outside the document,expression(, scripts, active CSS and every other function still removed or refused; the cairo export keeps colours, shapes and references; fixpoint. - B5
sheet.editremoverefused atomically (has_dependents, document unchanged) whiledependentsholds anything but descendants; a removal never adds a referential issue (property test). - B6 A6: real Inkscape 1.4.3 exports committed with their generator and provenance; Illustrator and Figma are not produced or imitated; A6 stays open until the owner's files arrive.
- B7 Wasm:
--remove-name-sectiononly; the 600 000-byte cap andsize.test.tsunchanged. - B8 Still: no SQL change, no protected reader modified (A13), the N-1 copies and frozen oracle files untouched (declared changes applied in tests only), no DEV operation, no merge.
After the reviews of 5281337 (security BLOCK(1) HIGH, verifier ECARTS(2))
Delta under review: 5281337..HEAD.
- B9 A
url(is kept only in its strict spelling (sanitize::local_url_target); every other spelling a browser could normalise (%XX, tab, space or unbalanced quote inside, empty or non-ASCII id) is active content;url(orrgb(glued to a longer name (ASCII or not) is another function; a colour is not glued to what follows; the composer refuses, fail-closed, a canvas keeping a reference outside its scope (unscoped_reference). Tests written apart from the reader (svg_clean::every_url_spelling_but_the_strict_one_is_refused,svg_scope::every_reference_a_browser_reads_stays_in_its_view). - B10 The verifier's doc drift fixed (RUST.md §12.1, §12.4, §12.5, §12.6; exports README); the MEDIUM (scope unique per document only) recorded as a requirement for any page inlining two documents (contract §10, RUST.md §12.7).