From 98060d74a302f141f8983b3624f0e225646b67c0 Mon Sep 17 00:00:00 2001 From: bchanot Date: Fri, 30 Oct 2026 12:50:01 +0100 Subject: [PATCH] chore(memory): V1-2.2 owner decisions, BDR-087, LRN-100, final review --- .claude/memory/decisions.md | 10 ++++++++++ .claude/memory/journal.md | 3 +++ .claude/memory/learnings.md | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 677b9c01..0a5b4613 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -641,3 +641,13 @@ Design choices: verdict snake_case in the shape M5 SQL reads (groups[{key,digest Alt: verdict in wasm (rejected, O15); handle-applied edits (kept free op, page holds text for undo); serde tagged derive for commands (rejected: +100 KB wasm). Reviews: verifier ECARTS(6) then ECARTS(3) (owner exports, helper); security PASS x2, MEDIUMs fixed (PIs, HTML fetchers, long-title bypass, quadratic groups, cubic view walk, bounds). Open owner: dangling #id across inlined drawings, clean upload = original bytes, stricter-than-table refusals, edit reading (contract 8.1/9.2), cairo rgb() colours. Module 596 671 B of 600 000. + +## BDR-087 — V1-2.2 canonical stored SVG form, owner-ratified (2026-10-30) +- **Status**: accepted +**Decision** (owner, 2026-10-30, on 05de816): drawings stored only in canonical form = deterministic serialisation by Rust core (`serialize::stored_form`). Original uploaded bytes never trusted as safe by default. Integrity (sha256, verdict `verification.integrity.svg_not_canonical`, preview `not_canonical`, upload tool) checked on representation actually stored. Fingerprints of approved historical resources kept (equine drawing sha256 `0ea5202f…`, fingerprint `12d78872…` unchanged). + +Also kept by owner: per-document-instance prefix required on top of per-view prefix (`fv..`); no multi-document inline rendering opened without it. Cairo strict numeric `rgb()`/`rgba()` kept, atomic `remove` refusal while named (`has_dependents`), wasm cap 600 000 B unchanged. + +**Rationale**: validated bytes = stored bytes = rendered bytes; no gap between what check saw and what browser reads. + +**Alternatives**: store original bytes after validation (rejected: validation and storage could diverge); re-serialise historical drawings (rejected: breaks approved fingerprints, archive reproduction). diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index c7d3b898..f0a507c2 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -485,3 +485,6 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp ## 2026-10-29 - 2026-10-29 V1-2.2 core built (size, review groups, verdict, PreviewSheet, sheet.edit, clean_svg); owner answers before code (exports by owner, integrity.document, draft load). Verifier ECARTS 6 then 3, security PASS x2, fixes ca31b78; check:all green. DEV untouched. STOP: READY FOR REVIEW. - V1-2.2 owner arbitrations on 17d9199: dangling SVG refs refused, canvas ids scoped per view, stored form required, strict rgb kept, remove refused while named, Inkscape 1.4.3 exports, wasm name section dropped. Security BLOCK(1) url(#%61) fixed a678faa, PASS. check:all green f1ef6a4. Open: A6 owner exports, per-document prefix. Not VERIFIED. + +## 2026-10-30 +- V1-2.2 owner decisions on 05de816: BDR-087 canonical stored SVG, LRN-099→LRN-100 strict reference grammar. Final review (Opus, Fable out of credits): verifier ECARTS(3) = A6 open, B9 LOW f1ef6a4 glued url( reader/composer mismatch fail-closed, FLOOR prose FP; security PASS (MEDIUM per-document prefix, 5 LOW). 05de816 = f1ef6a4 code. A6 not met. No fix, STOP at checkpoint. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 8ea3a7c9..eebd1d0e 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -673,3 +673,21 @@ Real vector exports vs R3 allowlist: cairo 1.18 writes colours as `rgb(20%, 40%, Apply: classify fixtures by actual outcome before writing expectations; report colour loss on cleaning as an owner decision (allow numeric rgb()/rgba() = reader change); dedupe attribute names in generators. Also: the tree drops processing instructions and comments, so "read with no removal" is not "bytes safe": `` survives in stored bytes; scan PIs separately (fail-closed) wherever original bytes are kept. + +## LRN-099 — SVG local references: one strict grammar shared by every stage (2026-10-30) +**Context**: V1-2.2 security round on 17d9199: `url(#%61)` and Chromium `url('#a')` passed dangling check, per-view scoping, expansion budget; browsers (Chromium 1248, Firefox 1555) resolved them. Root cause: reader, cleaner, composer each tolerated spellings browser normalises differently. Fixed a678faa (`sanitize::local_url_target`), f1ef6a4 (` ` ` ` ` ` spellings, composer coarse `url(` count sharing no parser). + +**Pattern**: one strict grammar for local references (`href`, `xlink:href`, `url(#id)`), shared by cleaning, validation (reader, verdict, preview, PDF snapshot gate), composition. Any encoded or ambiguous spelling (`%XX`, entity, tab/space/unbalanced quote inside, empty or non-ASCII id, `url(` glued to longer name) = active content, refused, never normalised. Composer check fail-closed, independent of reader parser. + +**Future application**: any new SVG/CSS consumer (editor page, PDF, preview, V1-2.5/2.6) reuses the grammar, never its own parser. Hostile tests written apart from the reader, asserting browser behaviour, not core behaviour. +- **Status (2026-10-30)**: superseded by LRN-100 + +## LRN-100 — SVG local references: one strict grammar, same reading in every stage (2026-10-30) +**Context**: V1-2.2 security round on 17d9199: `url(#%61)` and Chromium `url('#a')` passed dangling check, per-view scoping, expansion budget; browsers (Chromium 1248, Firefox 1555) resolved them. Root cause: stages tolerated spellings browser normalises differently. Fixed a678faa (`sanitize::local_url_target`), f1ef6a4 (` ` ` ` ` ` spellings, composer coarse `url(` count). Supersedes LRN-099 (wrong on glued names). + +**Pattern**: one strict grammar for local references (`href`, `xlink:href`, `url(#id)`), same interpretation in cleaning, validation (reader, verdict, preview, PDF snapshot gate), composition, browsers. Non-strict `url(` spelling (`%XX`, entity, tab/space/unbalanced quote inside, empty or non-ASCII id) = active content, refused, never normalised. `url(` glued to longer name = another function (removed in CSS attrs, kept elsewhere), not a reference. + +**Trap**: independent check must share grammar rules, not just avoid parser. f1ef6a4 composer count treats glued `xurl(` as reference → reader accepts, verdict passes, `view.canvas` refuses `unscoped_reference`, PDF draws (final review 2026-10-30, LOW, availability only). + +**Future application**: new SVG/CSS consumer reuses grammar. Hostile tests written apart from reader, asserting browser behaviour; every fail-closed branch gets a test reaching it. +Supersedes [[LRN-099]].