fix(anatomy): url() locality skips CSS whitespace only (security audit R3 pass 2)

This commit is contained in:
bchanot committed 2026-10-15 00:40:30 +02:00
1 parent 157c854ed1
commit 23895b9351
6 files changed
+90 -10

No files matched your search

+14 -5
View File
@@ -752,7 +752,7 @@ imports it and restyles `data-state` in place as before.
- O3 (`oracles/r3/highlight.json`): 36 highlighted compositions (every
observation and view of the three reports, an existing nested `<defs>`, a
detail view with its own asset and no viewBox): tree-equal.
- O4/O5 (`oracles/r3/sanitiser.json`): 41 hostile files
- O4/O5 (`oracles/r3/sanitiser.json`): 42 hostile files
(`tests/fixtures/svg/hostile`) and 10 generated cases: equal to the
TypeScript verdict or a declared one (9.4); the 4 product SVGs (horse
drawing, partner logo, 2 public logos) untouched, tree-equal. Mutation
@@ -762,7 +762,11 @@ imports it and restyles `data-state` in place as before.
searched from inside its own opener: `<!-->` let crafted markup hide 5,000
nesting levels or 3,000 attributes, then roxmltree overflowed the stack),
fixed with regression cases in cargo and through the shipped wasm; two LOW
(Unicode-spaced `href`, root painting attributes) fixed the same way.
(Unicode-spaced `href`, root painting attributes) fixed the same way. Pass 2
on the fix: PASS (about 4 million differential documents, prescan against
roxmltree: no undercount, no cap breach, no stack overflow on a 64 KiB stack;
the old desync and its variants answer `too_deep` on the shipped module); its
LOW (the same Unicode-space tolerance inside `url(`) fixed.
- Shipped wasm (`packages/core-wasm/tests/anatomy.test.ts`): the corpus plus
floods (99,000 nesting levels, 20,001 nodes, 150,000 `<` in a comment, 257
attributes, 2 MiB + 1, a 12 × 20 `<use>` chain, 1.9 MiB of `>`), each in a
@@ -792,7 +796,8 @@ imports it and restyles `data-state` in place as before.
canvas box); an `id` outside `[A-Za-z_][\w.:-]*` is removed; an `href` is
local only when it reads `#name` once ASCII whitespace is stripped, as the
URL parser strips it (the TypeScript also trimmed Unicode spaces, so a
no-break space before `#a` passed and resolved as a relative URL).
no-break space before `#a` passed and resolved as a relative URL); inside
`url(` only CSS whitespace is skipped before `#`, for the same reason.
4. A reference cycle, an expansion over 50,000 elements, and the floods of
9.2 step 1 are refused; the TypeScript accepted them (size counted on the
raw text, refused subtrees included).
@@ -833,8 +838,12 @@ imports it and restyles `data-state` in place as before.
- The engine (PDF) still sanitises with the TypeScript allowlist and has no
reference budget: the `<use>` expansion gate of `PDF_IMPORT_HARDENING.md`
§5 is met in the core, closed for the PDF path only when R4 switches it.
- roxmltree's recursion: safe behind the prescan depth cap; pin the release
with the iterative parser when it ships.
- roxmltree's recursion: safe behind the prescan depth cap (differentially
fuzzed, 9.3); pin the release with the iterative parser when it ships.
- References are checked inside one drawing; in the page `#id` resolves against
the whole document (the detail modal imports a second copy of the drawing,
as before R3). Drawings with their own assets (Step 13) should get ids
scoped per view before external uploads are drawn.
- Firefox and WebKit: not run here (no browser build); the owner's LAN run on
the phone covers WebKit.
- The degraded notice inside the canvas (9.4 item 7) and its wording ("le