Moment.js saw a minor version bump from 2.29.0 to 2.29.1, primarily focusing on internal improvements and bug fixes rather than introducing significant new features. Both versions share the same core functionality for parsing, validating, manipulating, and displaying dates and times in JavaScript, making them valuable tools for developers needing robust date handling. The fundamental developer experience remains consistent, with no breaking API changes anticipated between these versions.
Developers already using Moment.js should find upgrading straightforward, as no code modifications are likely required. The key difference lies in the dist object, where the unpacked size of version 2.29.1 is slightly larger (4209955 bytes) than 2.29.0 (4189886 bytes), suggesting minor code additions or adjustments. The release dates also highlight the recency of 2.29.1 (October 6, 2020) compared to 2.29.0 (September 22, 2020), indicating that the former incorporates the latest refinements. Both versions rely on the same suite of development dependencies, including tools for testing (QUnit, Karma), linting (ESLint), bundling (Rollup), and code formatting (Prettier), ensuring code quality and maintainability for developers contributing to or extending the library. While the core functionality and developer workflow stay consistent, opting for 2.29.1 ensures you're working with the most up-to-date and potentially more stable iteration of Moment.js for your date and time manipulation needs.
All the vulnerabilities related to the version 2.29.1 of the package
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:
Moment.js vulnerable to Inefficient Regular Expression Complexity
The problem is patched in 2.29.4, the patch can be applied to all affected versions with minimal tweaking.
In general, given the proliferation of ReDoS attacks, it makes sense to limit the length of the user input to something sane, like 200 characters or less. I haven't seen legitimate cases of date-time strings longer than that, so all moment users who do pass a user-originating string to constructor are encouraged to apply such a rudimentary filter, that would help with this but also most future ReDoS vulnerabilities.
There is an excellent writeup of the issue here: https://github.com/moment/moment/pull/6015#issuecomment-1152961973=
The issue is rooted in the code that removes legacy comments (stuff inside parenthesis) from strings during rfc2822 parsing. moment("(".repeat(500000))
will take a few minutes to process, which is unacceptable.