Expect version 24.1.0 is a minor release of the assertion library used extensively within the Jest testing framework. Both versions, 24.0.0 and 24.1.0, provide the core expect function, vital for writing robust and expressive unit tests. This function allows developers to make assertions about their JavaScript code, verifying that actual outcomes match expected results. Key features like .toEqual(), .toBe(), .toHaveBeenCalled(), and numerous other matchers empower nuanced testing strategies.
Looking at the metadata, the dependency list remains consistent between the two versions, including ansi-styles, jest-get-type, jest-regex-util, jest-message-util, and jest-matcher-utils, all at the same major versions. This suggests that the changes are likely bug fixes, performance enhancements, or internal refactoring rather than significant API alterations. The license and repository information is identical, solidifying that both versions are part of the Jest ecosystem and distributed under the MIT license.
The dist section reveals a subtle difference: the unpacked size. Version 24.1.0 is slightly smaller at 2671202 bytes compared to 24.0.0's 2671613 bytes. While minor, this reduction potentially indicates optimizations in the codebase. The release date distinguishes the versions, with 24.1.0 being released on February 5th, 2019, subsequent to 24.0.0's January 25th, 2019 release. Developers choosing between these versions should prioritize 24.1.0 because it likely incorporates bug fixes and refinements discovered after the initial 24.0.0 release, offering a more stable testing foundation.
All the vulnerabilities related to the version 24.1.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.