Repository navigation
test: pin styleBlockContents' unterminated-CDATA scan to EOF - #1088
Merged
Merged
Conversation
styleBlockContents() skips over CDATA sections so a </style> hidden in character data cannot end a <style> block early. The close === -1 arm -- a <![CDATA[ that is never terminated -- had no test: every existing CDATA case closes its section, so only the terminator-found arm was ever taken. The arm makes the scan run to end of file instead of abandoning the block, so an SVG that opens a CDATA section and never closes it still has its CSS scanned and its remote url() reported. Left unpinned, a refactor that stopped at the missing terminator would reopen that bypass of the remote-reference gate silently. Signed-off-by: quality <quality@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
This was referenced Oct 5, 2026
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.
Test Improvement
Adds one regression test to
tests/svg-active-content.test.mjspinning theclose === -1arm ofstyleBlockContents():styleBlockContents()skips over CDATA sections so that a</style>hidden incharacter data cannot end a
<style>block early. Every existing CDATA case inthe file (lines 588, 604, 777) closes its section, so only the
terminator-found arm was ever taken and the unterminated arm had no coverage.
That arm makes the scan run to end-of-file rather than abandon the block, so an
SVG that opens
<![CDATA[and never closes it still has its CSS scanned and itsremote
url()reported. Left unpinned, a refactor that stopped at the missingterminator would silently reopen that bypass of the remote-reference gate.
No production code changes — this PR is the test only.
Verification
TZ=UTC node --test tests/svg-active-content.test.mjs— 93 pass, 0 failnpm run test:unit:coverageatmain@8afaa67, node v26.10.0:scripts/lib/svg-active-content.mjs | 100.00 | 98.96 | | 251 261,src files | 100.00 | 99.92 | 2459/2461 regionsscripts/lib/svg-active-content.mjs | 100.00 | 99.48 | | 251,src files | 100.00 | 99.96 | 2461/2462 regions(open[1] ?? '')fallback, one of the known-unreachable?? ''cases tracked separately; it is untouched here.npx prettier --checkclean. The--check-source-regions 99floor issatisfied before and after, so no workflow file is involved.
Files and functions claimed
tests/svg-active-content.test.mjsonly, one added test adjacent to theexisting CDATA cases. Covers
styleBlockContents()inscripts/lib/svg-active-content.mjsviafindRemoteReferences(). No other openPR touches either file.
Related Issue
Closes #1087
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88