@swc/html
Affected
- introduced
0, fixed1.15.47-nightly-20260729.1(semver)
Fixed versions
1.15.47-nightly-20260729.1
Fix
- Fixed version
1.15.47-nightly-20260729.1npm install @swc/[email protected]
Advisory
Also known as: CVE-2026-72925
SWC HTML minifier may allow script element breakout when minifying embedded JSON
Impact
@swc/html minifies JSON contained in script elements such asapplication/json and application/ld+json by parsing and serializing the
JSON value.
Before the patched versions, JSON serialization could convert escaped
less-than signs such as \u003C into literal < characters. If the JSON
contained an escaped </script> sequence, the generated HTML could terminate
the containing script element early because HTML tokenization occurs before
the JSON is consumed.
Applications that minify HTML containing attacker-controlled JSON data could
therefore transform inert data into active markup. A crafted payload could
execute script in the origin of the generated page.
Patches
The issue is fixed in:
@swc/html 1.15.47swc_html_minifier 59.0.0The minifier now re-escapes less-than signs after JSON serialization, preserving
the script element boundary.
Workarounds
Users who cannot upgrade can disable JSON minification with:
await minify(html, {
minifyJson: false,
});Medium Basis: The source's own band: MODERATE
0, fixed 1.15.47-nightly-20260729.1 (semver)1.15.47-nightly-20260729.1
1.15.47-nightly-20260729.1npm install @swc/[email protected]0, fixed 59.0.0 (semver)59.0.0
59.0.0cargo update -p swc_html_minifier --precise 59.0.0Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0