Repository navigation
fix(security): reject every markup-bearing data: media type and legacy script scheme in the MDX scanner - #1219
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
…y script scheme in the MDX scanner
scripts/validate-architectures.mjs gates imported third-party architecture
bodies with findActiveContent() from scripts/lib/mdx-active-content.mjs, but
its DANGEROUS_URL_PATTERN recognised a strictly smaller set of schemes than
activeScheme() in scripts/lib/svg-active-content.mjs, which guards imported
SVGs against the identical threat.
Two gaps, both in that one constant:
* Only data:text/html was matched. A browser parses image/svg+xml,
application/xhtml+xml, text/xml and application/xml as documents too and
runs <script> in them, so the identical payload passed under a sibling
media type -- the rationale svg-active-content.mjs already states in its
own comment.
* Only javascript: and vbscript: were matched, while ACTIVE_SCHEMES also
carries livescript: and mocha:.
Widen the constant so the two scanners agree, and cover each newly gated
scheme in tests/mdx-active-content.test.mjs, including behind the character
references normalizeSchemes() decodes. No existing docs/, blog/, data/ or
src/ content matches the widened pattern, so the gate stays green on the
current tree.
Closes #1218
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
scripts/validate-architectures.mjsgates every imported third-partyarchitecture body with
findActiveContent()fromscripts/lib/mdx-active-content.mjs. ItsDANGEROUS_URL_PATTERNrecognised astrictly smaller set of schemes than
activeScheme()inscripts/lib/svg-active-content.mjs, which guards imported SVGs against theidentical threat.
Before:
Two gaps, both in that single constant:
data:text/html. A browser parsesimage/svg+xml,application/xhtml+xml,text/xmlandapplication/xmlas documents andruns
<script>in them, so the identical payload passed under a siblingmedia type. This is the rationale
svg-active-content.mjs:683-688alreadystates in its own comment (added by fix(security): reject every markup-bearing data: media type in activeScheme #1168) — only this file had not caught
up.
javascript:andvbscript:.ACTIVE_SCHEMES(
svg-active-content.mjs:32) also carrieslivescript:andmocha:.Verified against
main@ 593b9fe with base64 payloads, so no raw<element>is present to trip the unrelated element scan and the scheme test is the only
thing that can produce a finding:
What changed
Exactly two files, no behaviour outside the scheme test:
scripts/lib/mdx-active-content.mjs— widenDANGEROUS_URL_PATTERNto theset
svg-active-content.mjsalready rejects, with a comment pointing atthat module so the two stay paired.
tests/mdx-active-content.test.mjs— two new tests covering each of thefour media types and both legacy schemes, including behind the character
references
normalizeSchemes()decodes.Checks
node --test tests/mdx-active-content.test.mjs— 31/31 pass.npx prettier --checkon both changed files — clean.grepoverdocs/,blog/,data/andsrc/for all six newly gatedforms returns nothing, so the validator stays green on the current tree.
The remaining unit-test files fail in this environment only because
node_modulesis absent (Cannot find package 'react'); that is unrelated tothis diff.
Closes #1218
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