From 05af1e35714e760b916fd8aea96644b44ac0d27d Mon Sep 17 00:00:00 2001 From: sec-check Date: Thu, 8 Oct 2026 13:39:08 -0400 Subject: [PATCH] fix(security): gate srcset, poster and background in findRemoteReferences findRemoteReferences() decides by attribute name, and gated only src and href. srcset, poster and the legacy presentational background attribute are fetched by the browser on load with no user interaction, and are reachable because foreignObject is deliberately allowed, so an imported diagram could carry a third-party beacon that every gate in this repository reported as clean. srcset needs more than the name: it is a comma-separated candidate list, so normalizing it undivided strips the descriptors' whitespace and reads a local first candidate as same-origin, hiding every candidate after it. Each candidate's URL part is tested on its own. Closes #1212 Signed-off-by: sec-check --- scripts/lib/svg-active-content.mjs | 62 +++++++++++++++++++++++++-- tests/svg-active-content.test.mjs | 68 ++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 3 deletions(-) diff --git a/scripts/lib/svg-active-content.mjs b/scripts/lib/svg-active-content.mjs index e4bda78c..505a279e 100644 --- a/scripts/lib/svg-active-content.mjs +++ b/scripts/lib/svg-active-content.mjs @@ -515,6 +515,63 @@ function describeTarget(target) { return target.length > 120 ? `${target.slice(0, 117)}...` : target; } +/** + * Attribute names whose value a browser fetches on load, on any element. + * + * `href` is deliberately absent: it is gated per-element by RESOURCE_ELEMENTS, + * because `` is navigation the visitor chooses rather than a load the + * page performs. + * + * The rest are here because `` is allowed, so an imported + * diagram can carry ordinary HTML. `srcset` on ``/``, `poster` + * on `