92 lines
7.3 KiB
Markdown
92 lines
7.3 KiB
Markdown
# V1-2.2 reserved ids: evidence (2026-10-30)
|
||
|
||
Owner brief « V1-2.2 : correction de sécurité PDF et poursuite A6 » on `2f1f076`. Contract
|
||
`.claude/tasks/contracts/2026-10-30-v1-2-2-reserved-ids.md`; docs RUST.md §12.9.
|
||
|
||
## 1. Audit
|
||
|
||
- Written by the engine next to the drawing's ids: `osteo-halo` only (`compose::compose_highlight`, PDF view,
|
||
rasterised as a document of its own, drawing ids kept). Before the fix `ensure_halo_filter` returned early when
|
||
the drawing held a `filter#osteo-halo`; otherwise the filter went into the first `<defs>` (or a new one placed first),
|
||
so an element holding the id earlier in document order won `url(#osteo-halo)`.
|
||
- Not colliding: the canvas scopes every drawing id to `fv.<view>.` (page ids never start with `fv.`); the annotation
|
||
layer writes no `id`, and its `data-*` cannot be forged (the reader removes every `data-*`); the filter's `result`
|
||
names `haloWide` / `haloTight` resolve inside their filter only; `class="detail-zone"` styles nothing in the app CSS.
|
||
- Historical drawings: 75 committed SVG files; `osteo-overlays` in 11 of them (legacy editor group), among them
|
||
`supabase/seed/anatomical-sheets/equine/draft/assets/horse.svg` (sha256 `0ea5202f…`, the DEV object). `osteo-halo` in
|
||
none but the hostile fixture `crates/core/tests/fixtures/svg/hostile/osteo-halo-id.svg`. Hence an exact reserved set,
|
||
not an `osteo-*` namespace.
|
||
|
||
## 2. Pixel proof (Chromium 156.0.8078.4, Image + canvas as `browserRasterizer.ts`, 1200 × 943, main view, `hip` selected, halo on)
|
||
|
||
Composed SVG written by a throwaway integration test (never committed) from the equine drawing with a body injected
|
||
after the root's opening tag; pixels within ±24 per channel of `#b85a3f` counted.
|
||
|
||
| Drawing | Before (`2f1f076`) | After |
|
||
|---|---|---|
|
||
| equine, unchanged | composed, 1602 px | composed, 1602 px, SVG byte-identical |
|
||
| + `<filter id="osteo-halo"><feColorMatrix values="0 …0"/></filter>` | composed, **0 px** (marker erased) | refused `reserved_id` |
|
||
| + `<g id="osteo-halo"/><defs/>` | composed, 825 px (halo lost) | refused `reserved_id` |
|
||
|
||
## 3. Tests
|
||
|
||
`svg_reserved_ids` 9 tests; `pdf_session` + 1 (`the_pdf_refuses_a_reserved_id_and_keeps_its_own_halo`);
|
||
`anatomy_compose` R5.7 test renamed (`the_halo_filter_is_written_once_and_a_composed_root_is_refused`, ledger row
|
||
updated); `svg_clean` corpus line and `svg_sanitiser` declared divergence for `osteo-halo-id.svg`; core-wasm
|
||
`preview.test.ts` three spellings on the shipped module.
|
||
|
||
## 4. Mutations (`2026-10-30-v1-2-2-mutations-reserved-ids.py`)
|
||
|
||
11 of 11 killed: reader check removed, cleaning check removed, exact case only, `osteo-` prefix, root id unchecked,
|
||
descendants unchecked, highlight guard removed, canvas guard removed, pre-fix composer restored (guard removed and halo
|
||
skipped when the drawing holds one), halo not written, reason renamed. A first K9 (« skip the halo when the root has an
|
||
id ») survived: no tested drawing has a root id, a mutant with no meaning for the fix; replaced by the pre-fix restore.
|
||
|
||
## 5. Gates
|
||
|
||
- `pnpm rust:check`: green (fmt, clippy `-D warnings` on every feature set, 2032 tests summed over the feature passes,
|
||
ts-rs export, cargo deny).
|
||
- `pnpm check`: green (typecheck, core-wasm 65, supabase 128, app 566, lint, build). First run failed on
|
||
`r5.census.test.ts`: the ledger still named the renamed cargo test; row updated.
|
||
- Module: 559 360 → 560 015 B gzip -9 (+655 B), 1 513 522 → 1 513 968 B raw; Node's gzip 569 350 B (budget 600 000).
|
||
- `pnpm check:all` on the working tree (code as committed): green, e2e:ui PASSED, app image, worker sandbox tests and
|
||
runtime image; e2e:shell not run (needs the isolated stack, no change in its scope).
|
||
|
||
## 6. Independent reviews (fresh, Opus: the pinned Fable model was out of credits)
|
||
|
||
- Verifier: ECARTS(1) LOW, C8: a doc comment in the new `pdf_session.rs` helper held the shell expansion of `id` (an
|
||
unquoted heredoc while writing it), leaking the local uid and groups; fixed before any commit, the diff scanned for
|
||
other expansions (none). C1-C7, C9, C10 met; floor guard clean on the diff.
|
||
- Security: PASS, no regression or weakened control. Reported, pre-existing, owner decision: MEDIUM root `visibility`
|
||
(a drawing `<svg visibility="hidden">` with `visibility="visible"` children reads clean and the appended marker layer
|
||
inherits `hidden`: 0 highlight pixels in the PDF, markers gone in the canvas too); LOW root `stroke*` inheritance onto
|
||
the point hitbox; LOW the drawing chooses which `<defs>` receives the halo (sRGB vs linearRGB, cosmetic); LOW intended
|
||
behaviour change (re-export of an archive or a logo holding the id refused).
|
||
|
||
## 7. Root visibility (brief « V1-2.2 : arbitrage définitif A6 et correction visibility », on `81f7639`)
|
||
|
||
- Red first: error names added, no check wired: `svg_root_visibility` 2 of 6 failed (reader accepted `hidden`,
|
||
composers composed it), `pdf_session` 1 failed (export accepted it); a third failure was a fixture of mine (a literal
|
||
tab is not the stored form) and the test now checks the cleaned stored form. Green once the check is wired.
|
||
- Browser proof: RUST.md §12.10 table. Composed SVG by the core at `81f7639` (stash) and with the fix, throwaway
|
||
integration test never committed; measured with Playwright Chromium 156, Firefox 157, WebKit 27.2 from the local cache
|
||
(no install, every request outside about:/blob:/data: aborted). The accepted variants' SVG are byte-identical before
|
||
and after; the three hiding roots are refused after.
|
||
- Mutations: same script, V1 to V9 added; 20 of 20 killed (K rerun, so the reserved-id protections stay effective).
|
||
- Gates on the working tree: `pnpm check:all` green (cargo 2065 passed / 0 failed summed over the feature passes, ts-rs
|
||
types unchanged, wasm, core-wasm 65, supabase 128, app 566, lint, build, e2e:ui PASSED, app image, worker sandbox
|
||
tests and runtime image; e2e:shell not run). First run stopped on an unused import in the new suite (clippy
|
||
`-D warnings`), fixed. Fixtures: cairo, Figma, Inkscape, ImageMagick and owner-folder tests green.
|
||
- Module: 560 015 → 560 377 B gzip -9 (+362 B); Node's gzip 569 817 B (budget 600 000).
|
||
- Independent reviews of the working tree (fresh, Opus). Verifier ECARTS(3), all LOW: R3 the stroke properties no
|
||
marker sets were argued harmless without proof (docs corrected, now an open finding); R7 TODO J / J6 still waited on
|
||
Illustrator (closed by BDR-090); floor guard: assertions moved into `common/sheet_readers.rs` (clarification added to
|
||
the contract). R1, R2, R4-R6, R8, R9 met. Security PASS (semgrep 352 rules, 0 findings), no regression, `osteo-halo`
|
||
protections intact; three pre-existing MEDIUM marker-hiding vectors reported for the owner: root `viewBox` framing a
|
||
view without `view_box` (all 19 equine main-view markers out of frame, horse pixel-identical, accepted Clean);
|
||
inherited `stroke-opacity` / `stroke-dasharray` (canvas outlines gone, detail trigger 0 px in the three engines);
|
||
inherited `stroke-width` on the point hitbox (13 of 19 equine markers send their click to the last hitbox in
|
||
Chromium and WebKit). LOW: halo placement in a drawing-chosen `<defs>` (Firefox, WebKit lose the halo), root
|
||
`systemLanguage` / `display` canvas-PDF divergence (whole view), colour camouflage (inherent). Not built: the class fix
|
||
changes the R3 highlight oracle and the R4 digests (owner brief: stop before such a change).
|