comunidadestech
comunidadestech copied to clipboard
🚨 [security] Update moment: 2.29.1 → 2.29.4 (patch)
🚨 Your current dependencies have known security vulnerabilities 🚨
This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!
Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request.
What changed?
✳️ moment (2.29.1 → 2.29.4) · Repo · Changelog
Security Advisories 🚨
🚨 Inefficient Regular Expression Complexity in moment
Impact
- using string-to-date parsing in moment (more specifically rfc2822 parsing, which is tried by default) has quadratic (N^2) complexity on specific inputs
- noticeable slowdown is observed with inputs above 10k characters
- users who pass user-provided strings without sanity length checks to moment constructor are vulnerable to (Re)DoS attacks
Patches
The problem is patched in 2.29.4, the patch can be applied to all affected versions with minimal tweaking.
Workarounds
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.
References
There is an excellent writeup of the issue here: #6015 (comment)
Details
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.
🚨 Path Traversal: 'dir/../../filename' in moment.locale
Impact
This vulnerability impacts npm (server) users of moment.js, especially if user provided locale string, eg
fr
is directly used to switch moment locale.Patches
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).
Workarounds
Sanitize user-provided locale name before passing it to moment.js.
References
Are there any links users can visit to find out more?
For more information
If you have any questions or comments about this advisory:
- Open an issue in moment repo
Release Notes
2.29.2 (from changelog)
- Release Apr 3 2022
Does any of this look wrong? Please let us know.
Commits
See the full diff on Github. The new version differs by 27 commits:
Build 2.24.4
Bump version to 2.24.4
Update changelog for 2.29.4
[bugfix] Fix redos in preprocessRFC2822 regex (#6015)
Merge branch 'master' into develop
Revert "[bugfix] Fix redos in preprocessRFC2822 regex (#6015)"
[bugfix] Fix redos in preprocessRFC2822 regex (#6015)
Build 2.29.3
Fixup release complaints
Bump version to 2.29.3
Update changes for 2.29.3
[bugfix] Remove const usage (#5995)
misc: fix advisory link (#5990)
Build 2.29.2
Bump version to 2.29.2
Update changelog for 2.29.2
[bugfix] Avoid loading path-looking locales from fs
[misc] Fix indentation (according to prettier)
[test] Avoid hours around DST
[locale] ar-ly: fix locale name (#5828)
[misc] fix builds (#5836)
[misc] Specify length of toArray return type (#5766)
[locale] tr: update translation of Monday and Saturday (#5756)
[misc] fix lint issues (#5762)
[misc] optimize for loops (#5744)
[bugfix] add standalone and format to "cs" locale (#5749)
[locale] Fix Serbian locale (sr, sr-cyrl) (#5742)
Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase
.
All Depfu comment commands
- @depfu rebase
- Rebases against your default branch and redoes this update
- @depfu recreate
- Recreates this PR, overwriting any edits that you've made to it
- @depfu merge
- Merges this PR once your tests are passing and conflicts are resolved
- @depfu close
- Closes this PR and deletes the branch
- @depfu reopen
- Restores the branch and reopens this PR (if it's closed)
- @depfu pause
- Ignores all future updates for this dependency and closes this PR
- @depfu pause [minor|major]
- Ignores all future minor/major updates for this dependency and closes this PR
- @depfu resume
- Future versions of this dependency will create PRs again (leaves this PR as is)