Repository navigation
fix(security): gate srcset, poster and background in findRemoteReferences - #1213
Closed
hivecommons-hive[bot] wants to merge 1 commit into
Closed
hivecommons-hive[bot] wants to merge 1 commit into
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
…nces 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 <sec-check@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "sec-check" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will keep the |
This was referenced Oct 8, 2026
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security Fix
findRemoteReferences()inscripts/lib/svg-active-content.mjsis the gate that keeps a third-party host out of an SVG published fromstatic/at the site origin.mirrorArtworkUrls(),mirrorLandscapeLogo()andscripts/validate-architecture-assets.mjsall rely on it. It decides by attribute name, and gated onlysrcand (per-element)href.Three attributes a browser fetches on load, with no user interaction, were not gated:
srcset,posterand the legacy presentationalbackground. All three are reachable becauseforeignObjectis deliberately allowed, so an imported diagram can carry ordinary HTML, and none of them is active content —findActiveContent()reports nothing andstripActiveContent()removes nothing. An imported reference-architecture diagram or landscape logo could therefore carry a beacon that every gate in this repository reported as clean, and a visitor opening the SVG directly — a document, not an image, and served without the meta CSP that only Docusaurus HTML pages carry — discloses their IP, User-Agent and Referer to the chosen host.srcsetneeded more than adding the name. It is a comma-separated candidate list, so the whole value is not a URL:normalizeUri()strips the descriptors' whitespace, and"/local.png 1x, https://evil.example/x.png 2x"collapses to a value beginning with the local first candidate, which reads as same-origin and hides every candidate after it. Each candidate's URL part is now tested on its own. Splitting can never lose a target, because a comma cannot appear in a scheme or an authority.Verification
tests/svg-active-content.test.mjs; five of them fail onmainand all six pass here (the sixth pins that an all-localsrcsetstill reports nothing).node --test tests/svg-active-content.test.mjs: 127 pass, 0 fail (121 before).npm run test:unit: 1693 tests / 1639 pass / 54 fail, against amainbaseline of 1687 / 1633 / 54 in the same sandbox. The 54 failures are pre-existing and identical on both:@swc/corecannot load its native binding here, so the React component suites abort. No regression, and six new passes.npx prettier --checkclean on both files.Files touched:
scripts/lib/svg-active-content.mjs(newFETCHED_URL_ATTRIBUTESandurlAttributeTargets(), attribute branch offindRemoteReferences()) andtests/svg-active-content.test.mjs.Disjoint from #1206, which changes CSS quote/escape pairing (
stripCssComments,imageSetArguments,CSS_STRING) in the same file. This PR does not touch the CSS tokenizer,cssTargets(), or any function #1206 edits; it changes attribute-name coverage only.Closes #1212
Filed by sec-check agent (ACMM L4/L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=sec-check backend=copilot model=claude-opus-5 copilot=1.0.88