# Security gate, V1-2.2 owner arbitrations (diff 17d9199..HEAD) Mode: audit. Branch `feature/v1-2-anatomical-sheets`, worktree `v1-2`. Date 2026-10-29. ``` SECURITY — VERDICT: BLOCK(1) TOOL: semgrep 1.168.0 present but NOT RUN (p/security-audit, p/secrets, p/owasp-top-ten are fetched from the registry at run time and the brief forbids network) — effectively DEGRADED: checklist + guardrails scanner + manual attack review + probes on the built wasm module and on headless browsers SCOPE: 40 files BLOCKING: 1. [HIGH] url-reference-spelling-mismatch (reader and composer read fewer `url(#…)` spellings than browsers resolve) — crates/core/src/anatomy/svg/sanitize.rs:488 (url_targets), :502 (scope_url_targets), :523 (urls_are_local), :528 (calls_only_local_url); crates/core/src/anatomy/svg/refs.rs:115 (reference_ids); crates/core/src/anatomy/compose.rs:98 (scope_ids) — `fill="url(#%66v.main.g)"` (also `url(#%61)`, and in Chromium `url('#a')`) passes the sanitiser, is invisible to `check_targets`, `check_references` and `scope_url_targets`, and is resolved by Chromium and Firefox after percent-decoding: it defeats B1 (dangling check), B2 (view scoping, it reaches another view's `fv.main.g`) and the expansion budget (a 5 KB drawing hangs Chromium for 45 s) — hint: refuse in `urls_are_local` any `url(` whose target is not `#` + `[A-Za-z_][\w.:-]*` followed by optional space or the closing quote then `)` (so `url(#)`, `%`, tab, `/`, non-ASCII after `#` are refused as active), so the sanitiser admits exactly what `url_targets` reads; add a fail-closed check in `compose_canvas` that every composed `url(` target starts with the view scope REPORTED (non-blocking): - [MEDIUM] scope-key-is-view-id-only — crates/core/src/anatomy/compose.rs:92 — two documents that share a view id (every sheet has `main`) and are inlined in one page share the scope `fv.main.`; the first element in tree order wins, so §10 "never in another view" holds inside one document only - [LOW] colour-function-not-whole-value — crates/core/src/anatomy/svg/sanitize.rs:547 — strict `rgb()` is stripped wherever it sits in the value, so `rgb(1,2,3)rgb(4,5,6)` and `url(#a rgb(1,2,3))` (refused before) now pass; invalid CSS the browser drops, no fetch found in 19 hostile values - [LOW] test-oracle-shares-the-blind-spot — crates/core/tests/svg_scope.rs:107, apps/app/tests/helpers/svgTree.ts:112 — the oracles read references with `url_targets` / `replaceAll('url(#'`, so they cannot see a reader/browser divergence; no test uses `%`, tab or a non-id first character - [LOW] new-lint-allow (context, not a security suppression) — crates/core/tests/svg_scope.rs:6 — `#![allow(clippy::disallowed_methods, clippy::unwrap_used, clippy::expect_used)]`, same header as 49 other test files - [LOW] mutation-script-rewrites-sources — .claude/audits/2026-10-29-v1-2-2-mutations-arbitrations.py — edits source files in place and restores them in `finally`; a SIGKILL leaves a mutant in the tree (read only, not run) PROOF: semgrep 0 rules on 0 files (not run, no network) → 0 findings; checklist 9 checks (secrets, SQL concatenation, unsanitised render, authz, error surfaces, logging, tracked .env, guardrails scanner, new suppressions) → 1 context finding; manual attack review of 12 files + 3 probe families (built wasm module, Chromium 1248, Firefox 1555) → 1 HIGH, 1 MEDIUM, 3 LOW ``` REPORT_WRITTEN: .claude/audits/2026-10-29-v1-2-2-arbitrations-security.md ## 1. The blocking finding ### What the code does `sanitize::value_acceptable` (sanitize.rs:417) lets a `url(` through when the text after the opening, the CSS space and the optional quote starts with `#` (`urls_are_local`, :523), and when no other `(` remains (`calls_only_local_url`, :528). It does not look at what follows the `#`. Three readers then work on the same value, each with its own idea of "the id": - `url_targets` (:488) takes the longest run of `[A-Za-z0-9_.:-]` after `#`, and drops an empty one. - `scope_url_targets` (:502) writes the view scope after `#` only when the next character is in that set. - `refs::reference_ids` (refs.rs:115), which feeds `check_targets` (B1) and `check_references` (cycle and expansion budget), calls `url_targets`. When the first character after `#` is outside the set, all three see "no reference" and the value is stored and composed byte for byte. A browser does not: it percent-decodes the fragment (Chromium and Firefox, measured below), and Chromium also drops a tab inside a quoted CSS string (URL Standard: tab and newline are removed from the input). ### Probes (all throwaway, in the session scratchpad, nothing written in the worktree) 1. Built wasm module of the worktree (`packages/core-wasm/pkg`, built 16:28, after the last source edit at 16:18), `clean_svg` on a one-rect drawing: - `fill="url(#nope)"` gives `rejected dangling_reference`. - `fill="url(#%6eope)"` gives `clean`. The dangling check is bypassed. - `fill="url(#%66v.main.g)"` with a local `` gives `clean`. 2. Same module, `PreviewBuilder` on the equine draft document with that drawing as the horse asset, `view.canvas`: - view `main`: `` and ``. - view `head`: `` and ``. The reference is not rewritten. In the page the `head` rectangle resolves into the `main` canvas. 3. Browsers, inline SVG in an HTML page, `fill="url(#a)"` control painted red: | spelling | Chromium 1248 | Firefox 1555 | |---|---|---| | `url(#a)` | resolves | resolves | | `url(#%61)` | resolves | resolves | | `style="fill:url(#%61)"` | resolves | resolves | | `url(#%66v.other.x)` (another view's scoped id) | resolves | resolves | | `url('#a')` (` `) | resolves | does not | | `url(#nope)` | none | none | WebKit was not tested. 4. Budget bypass, Chromium 1248, nested masks written with `url(#%6dN)`, fan-out 10 per level, one root rectangle masked by level 0: | levels | size | render time | |---|---|---| | 5 | 3.3 KB page | 0.5 s | | 6 | 4.1 KB page | 4.6 s | | 7 | 4.8 KB page | 44.8 s | Each level costs ten times more. The same structure with plain `url(#mN)` is refused by `expanded_size` (10^7 against 50,000). In the core, a value of 250k `url(#a)` gives `too_complex` in 58 ms, the same value with `url(#%61)` gives `clean` in 107 ms. Firefox timing was not measured. ### Impact - B2 is not met: a drawing can resolve into another view of the page (paint servers, filters, masks, clip paths). Into the page itself the reach is theoretical today: no page-level SVG resource with an id exists in `apps/app/src` (the brand logos are loaded as `` or rasterised, not inlined). Visual only, no fetch, no script. - B1 is not met: a reference to an id the drawing does not define is accepted when spelled this way. - The R3 expansion budget is bypassed. An editor uploads under 5 KB, the verdict and the preview say `ok`, the reviewer's or any practitioner's tab freezes when the view draws. The PDF export rasterises the same view. - The budget bypass exists at 17d9199 (the old `urls_are_local` is the same). The diff does not create it, but B1 and B2 are written to close exactly this class and rest on the same reader, so they ship with the hole. ### Fix direction (no code written, report only) 1. Make the sanitiser the authority. In `urls_are_local` (or a new check called first in `value_acceptable`), require for every `url(`: CSS space, optional quote, `#`, one id that satisfies `is_reference_name` (first character `[A-Za-z_]`), then space, the same quote if one was opened, and `)`. Anything else is non-local and therefore active (rejected), which also removes `url(#)`. Then the set the sanitiser admits and the set `url_targets` reads are the same by construction. 2. Fail closed in the composer: after `scope_ids`, walk the composed tree and refuse the canvas (`ComposeError`) when a `url(` target does not start with the view scope, or an `href` does not start with `#fv..`. A future reader divergence then cannot produce an unscoped reference silently. 3. Tests with an independent oracle: for every accepted value, normalise the way the URL Standard does (strip tab and newline, percent-decode the fragment) and assert it equals the `url_targets` list; cases `url(#%61)`, `url(#%66v.x.g)`, `url('#a')`, `url(#)`, `url(#é)`, `url(#a%2Eb)` (allowed only if the first character rule holds). 4. After the fix, correct the statements that are false today: docs/development/ V1-2_ANATOMICAL_SHEETS.md §9.2 and §10 ("a reference resolves only inside its own view"), docs/development/RUST.md, docs/ANNOTATION-RENDERING.md. ## 2. Reported findings - MEDIUM, scope key. `id_scope` (compose.rs:92) is `fv..`. View ids are unique inside one document, not across sheets. A catalogue grid, a comparison or a preview next to the editor puts two `main` canvases in one page; ids collide and `getElementById` takes the first. Sheet B can then draw with sheet A's gradient or mask. Not verified against the V1-2.3+ screens (they are not in this diff). Add a per-handle token, or state in §10 that one sheet is mounted at a time. - LOW, colour function. `without_colour_functions` (:547) removes a strict `rgb()` anywhere in the text. Probed: 19 hostile values around a colour (`url(http://…)`, `expression(`, `image-set(`, `src(`, `cross-fade(`, `\72`, `/**/url(//…)`, `behavior:`, `@import`, `var(`, `attr(`, `element(`, `-moz-element(`, `paint(`, `RGB(`, nested `url(#a)` as an argument) are all refused or removed. The remaining looseness is cosmetic: `rgb(1,2,3)rgb(4,5,6)` and `url(#a rgb(1,2,3))` pass and are invalid CSS (bad-url token), dropped by the browser. - LOW, test oracle. See table line above. - LOW, lint allow and mutation script. See table lines above. ## 3. What was attacked and held - Colour exception, `smuggle url(`, `expression(`, escape, `image-set(`, fetch: a backslash is refused for every attribute before the colour code runs; `style_forbidden` runs on the original text; a `(` that is neither a local `url(#` nor a strict colour function stays and refuses the value. The colour parser admits only ASCII digits, `.`, `%`, comma, CSS space and `)` between `rgb(` and the end, so nothing can hide inside it. `glued` blocks `xrgb(`, `-rgb(`, `\rgb(`. Uppercase is refused (safe side). No index can leave the slice (`digits(end + 1)` only after a `.` at `end`; `index += 1` only after a matched separator). Probe table: 17 `fill` and 5 `style` values (19 hostile, 3 valid controls), all as expected. - Parsing cost, measured through the built module, attribute values near 2 MiB: `rgb(1,2,3)` x150k 132 ms, `rgb(` x400k 35 ms, `rgb(1,` x300k 37 ms, `rgb(` plus 1.9M spaces 26 ms, plus 1.9M digits 23 ms, mixed spacing 84 ms, `url(#` x400k 97 ms, `url(` x400k 15 ms. By reading: each failed colour attempt scans one run of digits and spaces that cannot contain `rgb`, and `from` always advances at least 3. - `check_targets`, `scope_ids`, `references_resolve`: one pass, recursion bounded by the prescan depth cap 64, one `HashSet`. Scoped output is bounded by the budget (50,000 references) plus 20,000 ids, then by `MAX_COMPOSED_BYTES` (4 MiB) after serialisation. - Scoping, spellings: `url( '#x')`, `URL(#x)`, newline and tab before `#` or the quote, and `.` in ids all go through the same `url_openings` / `skip_url_prefix` for the checker and the composer, so they agree with each other (the unit test at sanitize.rs:715 covers it). `href` and `xlink:href` are strict (`#` + reference name after ASCII trim), so a `%`, a tab or an odd prefix cannot be kept: a prefixed `x:href` is not on the allowlist and the `xlink:href` must be in the xlink namespace. View ids match `[a-z0-9][a-z0-9_-]{0,63}` (js.rs:158, enforced at deserialisation), so no `.` in a view id and one scope is never the start of another's. The layer has no `id`, `href` or `url(`. - Checker versus composer, same reading: `reference_ids` (all attributes through `url_targets`, `href` / `xlink:href` apart) and `scope_ids` (same set, `id` added) differ only on `id`, which cannot hold `(`. No attribute is rewritten and unread, or read and unrewritten. The one divergence is browser against both (finding 1). - Stored form: verdict (verdict.rs:323) and preview (preview.rs:119) compare the whole text with `stored_form(root)` after a removal-free read, so a comment, CDATA, entity, PI, BOM, another declaration or spacing cannot reach a round; the sha256 is checked first. The upload tool (upload.rs) and `clean_svg` do the same. Compose works on the sanitised tree, never on stored text. The `xmlns:xlink` value is unchecked but inert (a rebinding drops the xlink attributes that depend on it). - `sheet.edit remove` (edit.rs:570): `dependents` runs after `locate`, before any mutation, so a refusal leaves the document unchanged; it is a client rule, no authorisation change. - Checklist greps on the added lines (secrets, SQL built by concatenation, innerHTML / eval / raw, logging, tracked `.env`): nothing. Guardrails scanner: 0 FAIL, 28 WARN, all in migrations the diff does not touch, so none kept (gate rule). ## 4. Not done, and limits - semgrep did not run. The three packs come from the registry and the brief says no network. The Rust surface of those packs is thin; the manual review above is the substitute, it is not equivalent. - WebKit was not probed; the Firefox DoS time was not measured; the `` form is Chromium only. - Probes ran headless browsers on local files and Node on the built module. No cargo, wasm or Docker build was started (the `check:all` in the worktree was left alone). The probe files (HTML pages, screenshots, two Node scripts, a Firefox profile) sit in the session scratchpad `/tmp/claude-1000/-home-bchanot-Documents-faunosteo/0cee2841-f2bb-4081-9e59-3e6fe9cc8112/scratchpad/probe-audit`; the `rm -rf` that would have removed them was refused by the permission rules and was not retried by another route. Nothing was written in the worktree besides this report; `git status` there shows only this file and the owner's `exports/owner/README.md`. - The verdict runs in the core, client or worker side; the SQL side cannot check the stored form. That trust boundary is outside this diff. ## 5. Delta review (5281337..HEAD, commit a678faa) Fresh scan of the delta, mode audit, 2026-10-29. The report above was read first, as the brief required; nothing else from the earlier round was used. ``` SECURITY — VERDICT: PASS TOOL: semgrep 1.168.0 present but NOT RUN (p/security-audit, p/secrets, p/owasp-top-ten are registry packs fetched at run time and the brief forbids network) — effectively DEGRADED: checklist + guardrails scanner + manual attack review + the two named cargo suites + a model fuzz (section 5.7) SCOPE: 13 files (5 Rust: compose.rs, sanitize.rs, ops.rs, svg_clean.rs, svg_scope.rs; 8 docs, fixtures and audit files) BLOCKING: (none) REPORTED (non-blocking): - [MEDIUM] scope-key-is-view-id-only (carried from 5281337; now a written requirement, still not enforced by code or test) — crates/core/src/anatomy/compose.rs:99 — two documents inlined in one page share `fv.main.`, first in tree order wins; recorded in contract §10 and RUST.md §12.7; no screen inlines two documents today (consumers: apps/app/src/core/sheetOps.ts, services/sheetIndex.ts, anatomy/drawing.ts) - [LOW] composer-check-shares-the-reader-parser — crates/core/src/anatomy/compose.rs:105 — `references_scoped` calls `urls_are_local` and `url_targets`, the same `url_openings` / `local_url_target` as the sanitiser: it catches a `scope_ids` miss, it cannot see a future reader/browser divergence in those two functions; none today (5.7) - [LOW] tests-deliver-a-space-not-a-tab — crates/core/tests/svg_clean.rs:356, :357, :381; crates/core/tests/svg_scope.rs:338 — a raw TAB or LF inside an XML attribute is normalised to a space by the XML parser (roxmltree parse.rs:1364), so Chromium's ` ` spelling of the first HIGH reaches `local_url_target` in no test; hint: rows written ` ` and ` `, or a value-level unit test next to sanitize.rs:710 - [LOW] ts-oracle-plain-spelling-only (carried) — apps/app/tests/helpers/svgTree.ts:112 — still `replaceAll('url(#'`; it mirrors the core's rewrite for the product drawing, and the sanitiser now refuses every other spelling, so the blind spot has no reachable input - [LOW] mutation-script-rewrites-sources (carried) — .claude/audits/2026-10-29-v1-2-2-mutations-arbitrations.py — five mutants added (A13 to A17); it still edits sources in place and restores in `finally`; not run here, so their kill results are not verified by this gate PROOF: semgrep 0 rules on 0 files (not run, no network) → 0 findings; checklist 9 checks (secrets, SQL concatenation, unsanitised render, authz, error surfaces, logging, tracked .env, guardrails scanner, new suppressions) → 0 findings in the delta; cargo test svg_clean + svg_scope 21 passed, lib anatomy::svg 24 passed; model fuzz 8.4M strings in fill and style contexts + 2,400-case slot sweep + control run → 0 dangerous mismatches; manual attack review of 5 code files → 0 HIGH, 1 MEDIUM, 4 LOW ``` REPORT_WRITTEN: .claude/audits/2026-10-29-v1-2-2-arbitrations-security.md ### 5.1 Status of the previous findings | Previous finding | Now | |---|---| | HIGH url-reference-spelling-mismatch | Closed. One reading of `url(` (`local_url_target`, sanitize.rs:487) feeds `urls_are_local`, `url_targets`, `scope_url_targets` and `calls_only_local_url`, so the set the sanitiser admits, the set the dangling check and the budget count, and the set the composer rewrites are the same by construction. Fix directions 1, 2, 3 and 4 of section 1 are all done. | | MEDIUM scope key | Recorded as a requirement (contract §10, RUST.md §12.7). Open as a rule, see the reported list. | | LOW colour function not whole value | Closed: `colour_function_end` now requires end of text, CSS space, `;`, `,` or `!` after the `)`. `rgb(1,2,3)rgb(4,5,6)` is removed, `url(#a rgb(1,2,3))` is refused at the `url(`. | | LOW test oracle shares the blind spot | Closed in the core: `browser_references` (svg_scope.rs) reads `href="…"` and every `url(…)` on its own, trims quotes and CSS space, strips tab and newline, percent-decodes. The TS helper is carried, see above. | | LOW lint allow | Nothing new: the delta adds no lint attribute and no scanner, linter or type-checker silencing comment of any kind (grep on the added lines). | | LOW mutation script | Carried. | ### 5.2 What the delta reads like `local_url_target` accepts only: CSS space, an optional quote, `#`, a run of `[A-Za-z0-9_.:-]` that satisfies `is_reference_name` (first character `[A-Za-z_]`), the same quote, CSS space, `)`. `url_openings` skips a `url(` glued to a longer name (`continues_identifier`: ASCII alphanumeric, `_`, `-`, `\`, anything above U+007F). Every `urls_are_local` false is an active removal, so the file is refused, never cleaned. After a strict `url(...)` is cut out and the strict colour functions are removed, `calls_only_local_url` keeps a value only if no `(` is left. In the composer, `references_scoped` runs after `scope_ids` and before the layer is added, and `ops.rs:480` maps its failure to `svg_rejected` / `unscoped_reference`. ### 5.3 Re-attack, item by item Everything below was thrown at the strict reader and compared with a browser model (5.7). - Percent escapes, quoted and unquoted: `url(#%61)`, `url('#%61')`, `url(#a%61)`, `url(#a.%2e)`, `%23`, `%00`, `%20`. The id run stops at `%`, which is not followed by a quote, a space or `)`, so the value is not local and the file is refused. Same for `href="#%61"` and `xlink:href` (strict `#` + name). - Every C0 control and Unicode space, inside and around the quotes: an exhaustive sweep of 8 positions (before `url(`, after `url(`, after the quote, between `#` and the id, inside the id, at the id end, after the closing quote, before `)`) x 3 quote modes x 100 characters (U+0001 to U+0020, U+007F, U+0080 to U+00A0, U+1680, U+180E, U+2000 to U+200F, U+2028, U+2029, U+202F, U+205F, U+3000, U+FEFF, U+FFFD, `/**/`, `/*x*/`, `%`-forms, fullwidth `#` and `'`) = 2,400 values. 163 are accepted; every one has only CSS space (space, tab, LF, CR, FF) at the four legal slots, or a character before `url(` that is not part of the reference; 0 differ from the browser model. A NBSP or U+3000 after the quote or before the closing quote is refused, which is the Chromium/Firefox divergence of the first round. Controls other than tab, LF and CR cannot be carried by XML 1.0 at all. - CSS comments inside `url(`: `url(/**/#a)` is, in a browser, an unquoted URL whose text is `/**/#a` (a relative fetch); the reader refuses it (`/` is neither a quote nor `#`). `url(#a/**/)`, `url('#a'/**/)`, `url(/**/'#a')` are refused. `/**/url(#%61)` has a non-name character in front and is read as an opening, then refused on the `%`. - Escapes: a backslash still refuses the value for every attribute, before anything else runs (`value_acceptable`, `value_is_active`); unchanged. - `URL(`, `Url(`: ASCII-lowercase scan with identical byte offsets; no non-ASCII character folds to `url`. - Nested or repeated: `url(url(#a))`, `url(#a)url(#a)`, `url(#a) url(x)`: every opening must be strict. The 25,000-reference `%61` flood is refused as active content (`svg_clean.rs:346` test); the plain flood is `too_complex` as before. - `url(` inside a colour: `rgb(1,url(#a),3)` and `url(#a rgb(1,2,3))` leave a `(` or fail the strict window and are refused. - `)` inside quotes: `url(')')`, `url('#a)')` are refused (id then wrong closer). - `xlink:href` against `href`: both need `#` + a reference name after an ASCII trim (space, tab, LF, CR, FF); NBSP does not trim; `#a\tb`, `#a%61`, `# a` are refused. The composer demands `#fv..` on both. A prefixed `x:href` is not on the allowlist; `xlink:href` must sit in the xlink namespace. - Ids with `.` or `:`: `url(#a.b:c-d_e)` is accepted, scoped as `fv.main.a.b:c-d_e`, and a browser reads the same string. `svgView(` and `xpointer(` need `(`, which the id grammar excludes. `url(#-a)`, `url(#1a)`, `url(#é)` are refused. - Glued names with non-ASCII letters: `érgb(1,2,3)`, `éurl(#%61)`, ` url(`. A browser reads every code point above U+007F as part of the name, so these are single longer function names; the reader agrees and leaves the `(` in place, which refuses the value on a presentation attribute. A digit in front (`1url(`) is a dimension plus a block in a browser, never a fetch; the reader treats it as glued as well. A non-name character in front (`%`, `+`, `,`, `"`, `#`, `@`) keeps the `url(` an opening, so it must be strict. - A `(` surviving in a kept value: none. After the strict `url(...)` cut and the strict `rgb(`/`rgba(` removal, any remaining `(` refuses the value. In 2.5 million mutated accepted values (fill and style), the browser model saw only `url` tokens equal to a reader target and no function other than `rgb` or `rgba`. ### 5.4 The composer check `references_scoped` (compose.rs:105) walks the whole tree once, root included, and demands `#fv..` on every `href` and `xlink:href`, and for every other attribute whose lowercased value contains `url(`: `urls_are_local` and every target starting with the scope. Anything a sanitised drawing can still carry as a reference is one of those: the presentation attributes and `style` are the only CSS-parsed attributes on the allowlist that take a `` (`fill`, `stroke`, `filter`, `mask`, `clip-path`), `d`, `transform` and the rest are not read as CSS fetches, and no other attribute names an element. The layer is added afterwards and carries no `id`, `href` or `url(`: its colours are validated as hex at deserialisation (schema.rs:89, `js::is_hex_color`). It cannot be bypassed by a value the reader accepts. Its limit is that it shares the parser: it is a guard on `scope_ids`, not a second opinion on the reader (reported, LOW). ### 5.5 Cost No new quadratic walk. `references_scoped` is one pass with one lowercase copy per attribute value. `url_openings` searches forward from the last match; each opening's space and id runs end before the next opening's `(`, so runs do not overlap; `colour_function_end` adds one byte test. Slice indexes sit on ASCII boundaries (`#`, `)`, `u`, `r`), so no panic path appeared. Measured on a transliteration (5.7): 11 adversarial families (`url(#a) ` x N, `xurl(` x N, `url(` plus N spaces, `url(#aaa…`, `url(#a` x N overlapping, `rgb(1,2,3) ` x N, `rgb(1,url(#a),3)` x N, and others) doubled from 50k to 200k units: every ratio between 1.85 and 2.13. A first run showed a 4.5x ratio on the `rgb(1,2,3) ` family; that was the Python slice copy `text[at:]`, which the Rust `&text[at..]` does not make, and an offset-based port is linear. ### 5.6 Reported findings, detail - MEDIUM, scope key (carried). The requirement is written in two places and nothing enforces it. Today it has no victim: the only users of `view.canvas` in the app are the editor canvas and its detail modal, which draw views of one document, with different view ids and therefore different scopes. It becomes a defect on the first page that inlines two documents or two versions at once. Keep it as an entry criterion of that page (a per-handle token in `id_scope`, or a test that mounts two canvases with the same view id and fails). - LOW, composer shares the parser. A coarse second opinion would not share the code: after scoping, count the case-insensitive `url(` substrings of each value and require the count to equal `url_targets(...).len()`. It would also fail closed on a glued `xurl(` kept on a non-presentation attribute, which is harmless but unwanted in a drawing. - LOW, tests deliver a space. roxmltree turns a raw TAB, LF or CR in attribute text into a space (parse.rs:1364), so the rows `url('#\ta')`, `url('#a\tb')`, `url(\n#a)` and the hostile loop's `url('#\tg')` test a space. A character reference (` `) stays a tab per XML 1.0 §3.3.3; I could not read that branch of the parser (see 5.8). The reader is right on a tab (the model and the slot sweep refuse it), but a regression that skipped only tabs would pass the suite. - LOW, carried: TS oracle and mutation script, see the block. - Not a finding, product note: a reference to an id the grammar rejects (`url(#1a)`, `url(#é)`, for example an Illustrator export that keeps accented layer names as ids) now refuses the whole file with `svg_active_content`, where it used to pass unread. That is the owner's strict rule (§9.2), but the label tells the admin "active content" for what is only an unsupported id. ### 5.7 Method and what the probes are - Run for real: `cargo test -p faunosteo-core --test svg_clean --test svg_scope` (21 passed, 0.73 s) and `cargo test -p faunosteo-core --lib anatomy::svg` (24 passed), in the worktree. - The built wasm module cannot serve this round: `packages/core-wasm/pkg` is dated 16:28 and the delta's sources 16:46 and 16:48, so it still holds the first-round code. No build was started. - The fuzz and the sweeps ran on a Python transliteration of `url_openings`, `local_url_target`, `url_targets`, `scope_url_targets`, `urls_are_local`, `calls_only_local_url`, `colour_function_end`, `without_colour_functions` and the value rules of `value_acceptable`, typed in from sanitize.rs at a678faa, fed on stdin (no file written). Before use it was checked against the repo's own assertions (the 14 refused and 4 accepted `url` rows of svg_clean, the 5 glued or loose colour rows, the colour accepted and refused lists, the scoping unit test): all passed. It is not the compiled code. - The oracle is a second, independent piece: a CSS Syntax Level 3 tokenizer (comments, strings, numbers and dimensions, name code points above U+007F, `url(` unquoted token versus function, bad-url) plus the URL Standard reading of a reference (strip C0 and space at the ends, remove tab and newline, percent-decode the fragment). The property checked, per accepted value in a `fill` and in a `style` context: every URL the browser model resolves is exactly `#id` with the id one of the reader's targets, nothing external, no function other than `rgb` or `rgba`. After scoping, the same holds with the `fv.main.` prefix and `references_scoped` passes. - Volume: 400,000 grammar-generated strings, 3,000,000 and 2 x 2,500,000 mutants of 10 to 11 valid seeds (inserting, deleting or replacing from a 60-fragment vocabulary that includes `%61`, tabs, controls, Unicode spaces, comments, quotes, `url(`, `rgb(`, backslash), each in both contexts: 0 dangerous mismatches. About 543,000 accepted values carried a browser URL. 10,582 accepted values had a reference inside a comment or a string that the reader counts and the browser ignores: the safe direction (over-counting for the dangling check and the budget). - Control: the same harness on the pre-delta rules (`skip_url_prefix` plus longest id run) reported 52,752 divergent values out of 177,587 accepted (`url(#éa)`, `url(#a%'6)`, `url(#g'-h%2e)`), so the harness does detect the class the first round found. - Not run: any browser. The first round's Chromium and Firefox results are the only browser evidence; this round's browser behaviour comes from the specifications as modelled. WebKit was never probed. semgrep did not run (registry packs, no network). The guardrails scanner ran: 0 FAIL, 28 WARN, none in the delta's files. ### 5.8 Commands refused - A scratch cargo crate (path dependency on the worktree's core, own target directory, to run the real functions on the new spellings) was refused by the permission rules: "Permission to use Bash with command … has been denied", no rule named. My contract also forbids writing a code file outside this report, so I did not retry it by another tool or route; the Python transliteration above is the substitute and is weaker than running the Rust. - A `sed` on `parse.rs` of roxmltree in the cargo registry after a `cd` with a glob was refused with the deny rule `**/secrets/**`; not retried. The raw-whitespace normalisation at parse.rs:1364 had been read earlier through a `grep`; the character-reference branch was not. - Nothing else was written: `git status` in the worktree showed a clean tree before this section, and this file is the only one touched.