fix(anatomy): V1-2.2 owner arbitrations on SVG references and bytes

Refuse local references to ids a drawing does not define, scope canvas
ids per view, upload every drawing in one stored form checked by the
verdict and the preview, keep strict numeric rgb() colours, and commit
real Inkscape 1.4.3 exports with their generator.
This commit is contained in:
bchanot committed 2026-10-29 16:24:07 +01:00
1 parent 17d919971e
commit e823655f09
31 files changed
+1362 -110

No files matched your search

+15 -5
View File
@@ -6,19 +6,29 @@ None is edited by hand.
| File | Tool | How | Expected |
|---|---|---|---|
| `cairo-1.18.4-pycairo-1.27.0-shapes.svg` | cairo 1.18.4 through pycairo 1.27.0 | `generate.sh`: curves, gradient, dash, clip, alpha, text as glyph paths | cleanable: its colours are written `rgb(20%, 40%, 70%)`, a function the allowlist takes out of presentation attributes (`stop@stop-color`, `path@stroke`, `path@fill`, `g@fill`), so the cleaned drawing keeps its shapes and loses its colours |
| `cairo-1.18.4-pycairo-1.27.0-shapes.svg` | cairo 1.18.4 through pycairo 1.27.0 | `generate.sh`: curves, gradient, dash, clip, alpha, text as glyph paths | read with no removal: its colours are written `rgb(20%, 40%, 70%)`, the strict numeric colour function the reader keeps since the owner's decision of 2026-10-29 (before it, the four colours were removed) |
| `cairo-1.18.4-pycairo-1.27.0-raster.svg` | same | `generate.sh`: an 8 × 8 image surface painted | refused, `svg_active_content` (an embedded raster `<image>`) |
| `inkscape-1.4.3-inkscape-svg.svg` | Inkscape 1.4.3 (0d15f75042, 2025-12-25) | `generate-inkscape.sh`: `inkscape-source.svg` opened and exported as Inkscape SVG (`--export-type=svg`) | cleanable: `sodipodi:namedview`, the editor namespaces, `sodipodi:docname`, `xmlns:svg` and the `text` element removed and named; shapes, gradient, clip path, references and colours kept |
| `inkscape-1.4.3-plain-svg.svg` | same | `generate-inkscape.sh`: Plain SVG (`--export-plain-svg`) | cleanable: `xmlns:svg` and `text` removed |
| `inkscape-1.4.3-paths.svg` | same | `generate-inkscape.sh`: Plain SVG, every object to a path, text to outlines (`--actions='select-all:all;object-to-path'`, `--export-text-to-path`) | cleanable: `xmlns:svg` and `path@aria-label` removed; the outlined text stays as paths |
| `imagemagick-7.1.2-18-draw.svg` | ImageMagick 7.1.2-18 Q16 | `generate.sh`: `-draw` circle, rectangle, polyline | read with no removal |
| `imagemagick-7.1.2-18-mvg.svg` | same | `generate.sh`: an MVG file (its style settings land as bare text between elements, which the reader drops) | read with no removal |
`bash generate.sh` rewrites them from the tools installed here (no network).
`bash generate.sh` rewrites the cairo and ImageMagick files from the tools installed here (no
network). `inkscape-source.svg` is not an export: a small drawing written by hand that Inkscape
opens; `bash generate-inkscape.sh <inkscape binary>` writes the three Inkscape files from it.
Inkscape is not installed on the development machine: on 2026-10-29 (owner go) the Ubuntu
archive package `inkscape_1.4.3-0ubuntu2_amd64.deb` (sha256 `24a2e922…918326e`, equal to the
archive index) and its missing libraries were downloaded with `apt-get download` into the
session's scratch folder, unpacked with `dpkg-deb -x` and run from there (no install, no
sudo); inkscape.org, where the AppImage lives, answered 504 and timed out that day.
## Editor exports, supplied by the owner (`owner/`)
The editors an administrator actually uses (Inkscape, Illustrator, Figma, Affinity) are not
installed on the development machine; the owner exports a small drawing from each and puts
Illustrator, Figma and Affinity are not available on the development machine (Inkscape is
covered above by a real 1.4.3 export); the owner exports a small drawing from each and puts
the files in `owner/`, named `<tool>-<version>-<what>.svg` (for example
`inkscape-1.4.2-plain-svg.svg`, `illustrator-29.3-export-as.svg`). The suite reads every file
`illustrator-29.3-export-as.svg`, `figma-125.8-export.svg`). The suite reads every file
there: each must be refused (with a closed reason) or cleaned into a drawing that reads back
with no removal, and a file whose name contains `-active-` must be refused for active content.
Until files arrive, that test runs on an empty folder and the report of V1-2.2 says so.
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Writes the Inkscape exports of `tests/svg_clean.rs` (V1-2.2, contract §9.2, owner decision
# 2026-10-29) from `inkscape-source.svg`, a small drawing written by hand that Inkscape opens
# and exports; the output files are Inkscape's own serialisation. Run from this folder with
# the Inkscape binary as the only argument: bash generate-inkscape.sh /path/to/inkscape
# (no network; the version goes in the file names).
set -euo pipefail
inkscape="$1"
version=$("$inkscape" --version 2>/dev/null | sed -n 's/^Inkscape \([0-9.]*\).*/\1/p')
prefix="inkscape-${version}"
# Inkscape SVG (the editor's own format: sodipodi / inkscape namespaces, metadata).
"$inkscape" inkscape-source.svg --export-type=svg --export-filename="${prefix}-inkscape-svg.svg"
# Plain SVG (« Enregistrer une copie… » › SVG simple).
"$inkscape" inkscape-source.svg --export-plain-svg --export-filename="${prefix}-plain-svg.svg"
# Plain SVG with every object converted to a path and the text to outlines, as a drawing is
# usually prepared before it is handed over.
"$inkscape" inkscape-source.svg --export-plain-svg --export-text-to-path \
--actions='select-all:all;object-to-path' --export-filename="${prefix}-paths.svg"
ls -1 "${prefix}"-*.svg
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="200"
height="150"
viewBox="0 0 200 150"
version="1.1"
id="svg3"
sodipodi:docname="inkscape-source.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview3"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" />
<defs
id="defs2">
<linearGradient
id="coat"
x1="0"
y1="0"
x2="1"
y2="0">
<stop
offset="0"
stop-color="#8a5a3c"
id="stop1" />
<stop
offset="1"
stop-color="#d9b48f"
stop-opacity="0.8"
id="stop2" />
</linearGradient>
<clipPath
id="frame">
<rect
x="10"
y="10"
width="180"
height="130"
id="rect2" />
</clipPath>
</defs>
<g
id="body"
clip-path="url(#frame)">
<path
d="M20 110 C40 40 150 30 180 100 L170 120 L30 125 Z"
fill="url(#coat)"
stroke="#333"
stroke-width="2"
stroke-dasharray="6 3"
id="path2" />
<ellipse
cx="160"
cy="55"
rx="18"
ry="12"
fill="#c49a6c"
id="ellipse2" />
<rect
x="60"
y="60"
width="40"
height="20"
rx="4"
fill="rgb(51, 102, 179)"
fill-opacity="0.5"
id="rect3" />
</g>
<text
x="70"
y="140"
font-family="DejaVu Sans"
font-size="12"
id="text3">Garrot</text>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="200"
height="150"
viewBox="0 0 200 150"
version="1.1"
id="svg3"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs2">
<linearGradient
id="coat"
x1="0"
y1="0"
x2="1"
y2="0">
<stop
offset="0"
stop-color="#8a5a3c"
id="stop1" />
<stop
offset="1"
stop-color="#d9b48f"
stop-opacity="0.8"
id="stop2" />
</linearGradient>
<clipPath
id="frame">
<rect
x="10"
y="10"
width="180"
height="130"
id="rect2" />
</clipPath>
</defs>
<g
id="body"
clip-path="url(#frame)">
<path
d="M20 110 C40 40 150 30 180 100 L170 120 L30 125 Z"
fill="url(#coat)"
stroke="#333"
stroke-width="2"
stroke-dasharray="6 3"
id="path2" />
<path
id="ellipse2"
style="fill:#c49a6c"
d="M 178,55 A 18,12 0 0 1 160,67 18,12 0 0 1 142,55 18,12 0 0 1 160,43 18,12 0 0 1 178,55 Z" />
<path
id="rect3"
style="fill:#3366b3;fill-opacity:0.5"
d="m 64,60 h 32 c 2.216,0 4,1.784 4,4 v 12 c 0,2.216 -1.784,4 -4,4 H 64 c -2.216,0 -4,-1.784 -4,-4 V 64 c 0,-2.216 1.784,-4 4,-4 z" />
</g>
<path
d="m 77.142578,138.75195 v -2.34961 h -1.933594 v -0.97265 h 3.105469 v 3.75586 q -0.685547,0.48632 -1.511719,0.73828 -0.826172,0.24609 -1.763672,0.24609 -2.050781,0 -3.210937,-1.19531 -1.154297,-1.20117 -1.154297,-3.33984 0,-2.14454 1.154297,-3.33985 1.160156,-1.20117 3.210937,-1.20117 0.855469,0 1.623047,0.21094 0.773438,0.21093 1.423828,0.62109 v 1.25977 q -0.65625,-0.55664 -1.394531,-0.83789 -0.738281,-0.28125 -1.552734,-0.28125 -1.605469,0 -2.414063,0.89648 -0.802734,0.89648 -0.802734,2.67188 0,1.76953 0.802734,2.66601 0.808594,0.89649 2.414063,0.89649 0.626953,0 1.11914,-0.10547 0.492188,-0.11133 0.884766,-0.33985 z m 6.269531,-2.05078 q -1.30664,0 -1.810547,0.29883 -0.503906,0.29883 -0.503906,1.01953 0,0.57422 0.375,0.91406 0.38086,0.33399 1.03125,0.33399 0.896485,0 1.435547,-0.63281 0.544922,-0.63868 0.544922,-1.69336 v -0.24024 z M 85.5625,136.25586 V 140 h -1.078125 v -0.99609 q -0.369141,0.59765 -0.919922,0.88476 -0.550781,0.28125 -1.347656,0.28125 -1.007813,0 -1.605469,-0.5625 -0.591797,-0.56836 -0.591797,-1.51758 0,-1.10742 0.738281,-1.66992 0.744141,-0.5625 2.214844,-0.5625 h 1.511719 v -0.10547 q 0,-0.74414 -0.492188,-1.14843 -0.486328,-0.41016 -1.371093,-0.41016 -0.5625,0 -1.095703,0.13476 -0.533204,0.13477 -1.025391,0.4043 v -0.99609 q 0.591797,-0.22852 1.148437,-0.33985 0.556641,-0.11718 1.083985,-0.11718 1.423828,0 2.126953,0.73828 0.703125,0.73828 0.703125,2.23828 z m 6.023437,-1.81055 q -0.18164,-0.10547 -0.398437,-0.15234 -0.210938,-0.0527 -0.46875,-0.0527 -0.914063,0 -1.40625,0.59766 -0.486328,0.5918 -0.486328,1.70508 V 140 h -1.083985 v -6.5625 h 1.083985 v 1.01953 q 0.339844,-0.59766 0.884765,-0.88476 0.544922,-0.29297 1.324219,-0.29297 0.111328,0 0.246094,0.0176 0.134766,0.0117 0.298828,0.041 z m 4.722657,0 q -0.181641,-0.10547 -0.398438,-0.15234 -0.210937,-0.0527 -0.46875,-0.0527 -0.914062,0 -1.40625,0.59766 -0.486328,0.5918 -0.486328,1.70508 V 140 h -1.083984 v -6.5625 h 1.083984 v 1.01953 q 0.339844,-0.59766 0.884766,-0.88476 0.544922,-0.29297 1.324218,-0.29297 0.111329,0 0.246094,0.0176 0.134766,0.0117 0.298828,0.041 z m 3.410156,-0.25195 q -0.867188,0 -1.371094,0.67969 -0.503906,0.67382 -0.503906,1.85156 0,1.17773 0.498047,1.85742 0.503906,0.67383 1.376953,0.67383 0.86133,0 1.36523,-0.67969 0.50391,-0.67969 0.50391,-1.85156 0,-1.16602 -0.50391,-1.8457 -0.5039,-0.68555 -1.36523,-0.68555 z m 0,-0.91406 q 1.40625,0 2.20898,0.91406 0.80274,0.91406 0.80274,2.53125 0,1.61133 -0.80274,2.53125 -0.80273,0.91406 -2.20898,0.91406 -1.412109,0 -2.214844,-0.91406 -0.796875,-0.91992 -0.796875,-2.53125 0,-1.61719 0.796875,-2.53125 0.802735,-0.91406 2.214844,-0.91406 z m 5.86523,-1.70508 v 1.86328 h 2.22071 v 0.83789 h -2.22071 v 3.5625 q 0,0.80273 0.2168,1.03125 0.22266,0.22852 0.89649,0.22852 h 1.10742 V 140 h -1.10742 q -1.24805,0 -1.72266,-0.46289 Q 104.5,139.06836 104.5,137.83789 v -3.5625 h -0.79102 V 133.4375 H 104.5 v -1.86328 z"
id="text3"
style="font-size:12px;font-family:'DejaVu Sans'"
aria-label="Garrot" />
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="200"
height="150"
viewBox="0 0 200 150"
version="1.1"
id="svg3"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs2">
<linearGradient
id="coat"
x1="0"
y1="0"
x2="1"
y2="0">
<stop
offset="0"
stop-color="#8a5a3c"
id="stop1" />
<stop
offset="1"
stop-color="#d9b48f"
stop-opacity="0.8"
id="stop2" />
</linearGradient>
<clipPath
id="frame">
<rect
x="10"
y="10"
width="180"
height="130"
id="rect2" />
</clipPath>
</defs>
<g
id="body"
clip-path="url(#frame)">
<path
d="M20 110 C40 40 150 30 180 100 L170 120 L30 125 Z"
fill="url(#coat)"
stroke="#333"
stroke-width="2"
stroke-dasharray="6 3"
id="path2" />
<ellipse
cx="160"
cy="55"
rx="18"
ry="12"
fill="#c49a6c"
id="ellipse2" />
<rect
x="60"
y="60"
width="40"
height="20"
rx="4"
fill="rgb(51, 102, 179)"
fill-opacity="0.5"
id="rect3" />
</g>
<text
x="70"
y="140"
font-family="DejaVu Sans"
font-size="12"
id="text3">Garrot</text>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="150" viewBox="0 0 200 150">
<defs>
<linearGradient id="coat" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#8a5a3c"/>
<stop offset="1" stop-color="#d9b48f" stop-opacity="0.8"/>
</linearGradient>
<clipPath id="frame"><rect x="10" y="10" width="180" height="130"/></clipPath>
</defs>
<g id="body" clip-path="url(#frame)">
<path d="M20 110 C40 40 150 30 180 100 L170 120 L30 125 Z" fill="url(#coat)" stroke="#333" stroke-width="2" stroke-dasharray="6 3"/>
<ellipse cx="160" cy="55" rx="18" ry="12" fill="#c49a6c"/>
<rect x="60" y="60" width="40" height="20" rx="4" fill="rgb(51, 102, 179)" fill-opacity="0.5"/>
</g>
<text x="70" y="140" font-family="DejaVu Sans" font-size="12">Garrot</text>
</svg>

After

Width:  |  Height:  |  Size: 814 B