Expect versions 24.0.0 and 23.6.0 both serve the same core purpose: providing the expect function central to Jest testing. Developers upgrading should note the change in dependencies. Version 24.0.0 replaces the direct dependency on jest-diff (present in 23.6.0) with what appears to be a more cohesive set of related jest-* utilities, specifically bumping and aligning the versions of jest-get-type, jest-regex-util, jest-message-util, and jest-matcher-utils to 24.0.0. Furthermore, version 24 introduces the "directory" field within the repository section of the package.json, specifying packages/expect, which might be relevant for developers contributing to the Jest project itself. The dist section reveals a significant increase in unpacked size from 576 KB in 23.6.0 to roughly 2.6 MB in 24.0.0, and an increase of 2 files included in the package as well. This substantial jump likely stems from underlying changes and additions within the aligned Jest utilities. Expect 24 incorporates internal code updates, and is likely not significant for developers consuming expect directly-- however, developers using expect in any standalone capacity should check the Jest release notes. The package version changes also included an updated releaseDate which shows when the version of the package was published.
All the vulnerabilities related to the version 24.0.0 of the package
Regular Expression Denial of Service (ReDoS) in micromatch
The NPM package micromatch
prior to version 4.0.8 is vulnerable to Regular Expression Denial of Service (ReDoS). The vulnerability occurs in micromatch.braces()
in index.js
because the pattern .*
will greedily match anything. By passing a malicious payload, the pattern matching will keep backtracking to the input while it doesn't find the closing bracket. As the input size increases, the consumption time will also increase until it causes the application to hang or slow down. There was a merged fix but further testing shows the issue persisted prior to https://github.com/micromatch/micromatch/pull/266. This issue should be mitigated by using a safe pattern that won't start backtracking the regular expression due to greedy matching.
Uncontrolled resource consumption in braces
The NPM package braces
fails to limit the number of characters it can handle, which could lead to Memory Exhaustion. In lib/parse.js,
if a malicious user sends "imbalanced braces" as input, the parsing will enter a loop, which will cause the program to start allocating heap memory without freeing it at any moment of the loop. Eventually, the JavaScript heap limit is reached, and the program will crash.