Micromatch is a popular JavaScript library designed for efficient and versatile glob matching, serving as a faster and more streamlined alternative to minimatch and multimatch. Comparing versions 3.1.10 and 3.1.9 unveils subtle but potentially impactful changes for developers. Both versions share a common foundation, including core dependencies like braces, extglob, and nanomatch for advanced pattern expansion and matching. Development dependencies, crucial for testing and building, also remain consistent.
The primary difference lies in the to-regex dependency. Version 3.1.10 updates to-regex from 3.0.1 to 3.0.2. This update, while seemingly minor, could include bug fixes, performance enhancements, or new features within the to-regex library that affect how micromatch converts glob patterns into regular expressions. This is a crucial aspect for performance and accuracy, directly impacting the glob matching process.
Furthermore, file sizes differ slightly, with version 3.1.10 having an unpacked size of 84811 compared to 84810 in the previous version. While seemingly insignificant, the single byte change, could indicate code changes or adjustments within the package. Finally, the release dates of the versions show an approximate one month gap which suggests continuous maintenance and improvement. Developers should consider these factors when choosing between the two versions, especially those concerned with the underlying regular expression conversion or seeking the most up-to-date bug fixes.
All the vulnerabilities related to the version 3.1.10 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.