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

@@ -0,0 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg"><filter id="f"/><path d="M0 0h1" fill="url( #f)"/><path d="M0 0h1" style="fill:url( #f)"/><path d="M0 0h1" filter="url( #f)"/><path d="M0 0h1" filter="url(
#f)"/></svg>

After

Width:  |  Height:  |  Size: 211 B

@@ -3960,6 +3960,62 @@
"unbound-prefix.svg": {
"rejected": "malformed"
},
"url-unicode-space.svg": {
"removed": [],
"tree": {
"ns": "http://www.w3.org/2000/svg",
"name": "svg",
"attrs": {
"xmlns": "http://www.w3.org/2000/svg"
},
"children": [
{
"ns": "http://www.w3.org/2000/svg",
"name": "filter",
"attrs": {
"id": "f"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "path",
"attrs": {
"d": "M0 0h1",
"fill": "url( #f)"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "path",
"attrs": {
"d": "M0 0h1",
"style": "fill:url( #f)"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "path",
"attrs": {
"d": "M0 0h1",
"filter": "url( #f)"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "path",
"attrs": {
"d": "M0 0h1",
"filter": "url( #f)"
},
"children": []
}
]
}
},
"use-mutual-cycle.svg": {
"removed": [],
"tree": {
+4
View File
@@ -42,6 +42,10 @@ fn declared(file: &str) -> Option<Value> {
// stripped, nothing else); the TS trimmed JavaScript spaces (security audit R3).
"href-unicode-space.svg" => json!({ "removed": ["use@href", "use@xlink:href"],
"strip_unicode_spaced_refs": true }),
// C3 references: `url(` skips CSS whitespace only, as the browser's tokenizer does
// (security audit R3, pass 2): a Unicode space before `#` is not local.
"url-unicode-space.svg" => json!({ "removed": ["path@fill", "path@style"],
"strip": [["path", "fill"], ["path", "style"]] }),
// C3 root: nothing that paints outside the box on the inline root (security audit R3).
"root-presentation.svg" => {
json!({ "removed": ["svg@transform", "svg@filter", "svg@mask", "svg@clip-path"] })