Repository navigation
fix(deps): update dependency html-minifier to v5 [security] - #895
Closed
renovate[bot] wants to merge 1 commit into
Closed
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
Member
|
Substituído pelo #896, que remove o html-minifier do SSR em vez de subir para a v5 (detalhes no PR). |
Contributor
Author
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
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.
This PR contains the following updates:
^4.0.0→^5.0.0HTML Minifier Next: Regular expressions in
minify()cause O(n²) backtracking on ignored and custom-fragment contentCVE-2026-140010 / GHSA-9wmg-23wv-h297
More information
Details
Summary
html-minifier-next finds the last HTML tag inside htmlmin:ignore blocks with the expression /[\s\S]<(/?[a-zA-Z][\w:-])/. A large ignore block without a matching tag makes the greedy prefix rescan the content, so the public minify() API takes about 89 seconds for 256 KB.
A second expression with the same flaw,
/^(\s*)[\s\S]?(\s)$/, splits whitespace off matches ofignoreCustomFragments. A long whitespace run inside such a fragment triggers it with default options, since the default fragments cover<? … ?>and<% … %>(64 KB: about 3.3 s).Affected component and version
j9t/html-minifier-nextRE_LAST_HTML_TAG), :1795 (exec onhtmlmin:ignorecontent, requirescollapseWhitespace); src/htmlminifier.js:1279 (whitespace split ofignoreCustomFragmentsmatches, default options)html-minifier is affected as well: The custom-fragment issue dates back to html-minifier 3.1.1, and 5.0.0, rebuilt on HTML Minifier Next 9.1.1, carries both.
Reproduction input
minify() on a document containing a large htmlmin:ignore block whose content is plain text with no '<tag' terminator (N=256000 characters).
Measured timings
The following values were measured against the real code path described above. Times are wall-clock milliseconds.
Additional finding (maintainer)
Input:
<p><?php a' + ' '.repeat(n) + 'a ?></p>, minify() with default options.n=8000: 67 ms · n=16000: 206 ms · n=32000: 840 ms · n=64000: 3332 ms
The lazy
[\s\S]?retries(\s)$across the whole whitespace run at each step.Impact
A modest attacker-controlled input drives superlinear or unbounded regular-expression backtracking (or recursive stack exhaustion), occupying a CPU core for seconds to minutes and enabling denial of service against the affected service or library consumer.
Suggested fix
Replace the ambiguous expression with an unambiguous, linear-time equivalent (bounded character classes, possessive or atomic groups, or an index-based scanner), enforce a length limit at the entry point, and add a regression test using the adversarial input above.
Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
j9t/html-minifier (html-minifier)
v5.0.1Compare Source
Fixed
minify()path, now replaced by linear-time scans:htmlmin:ignoreblock without tags, withcollapseWhitespaceenabledignoreCustomFragmentsmatch, with default optionsv5.0.0Compare Source
Fixed
decodeEntities(andminifyJS, in event handler attributes) turning an escaped ampersand into one that starts a character reference, which changed the value browsers read (e.g.,title="&copy b"→title="© b", read as “© b,” now kept; and in text,&#​169→&#​169, now&#169)decodeEntities(andminifyJS, in event handler attributes) leaving character references without a semicolon in attributes undecoded where browsers decode them (e.g.,title="© b", nowtitle="© b")Changed
hmas a short CLI command next tohtml-minifierConfiguration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.