Chokidar, a popular Node.js library providing a robust wrapper around the often-inconsistent native fs.watch and fs.watchFile APIs, saw a minor version update from 2.1.2 to 2.1.3. Both versions share the same core purpose: simplifying file system monitoring for changes, additions, and deletions. This makes them invaluable for developers building tools requiring real-time file system awareness, such as live-reloading development servers, automated build systems, and file synchronization applications.
A subtle but significant difference resides in the dependencies. Version 2.1.3 updates the upath dependency from ^1.1.0 to ^1.1.1. While seemingly small, such dependency updates often include bug fixes, performance enhancements, or security patches within the upath library (a utility for consistent path manipulation across different operating systems.
The dist section also reveals minor variations. The unpackedSize decreased slightly from 86484 bytes in version 2.1.2 to 86020 bytes in version 2.1.3 suggesting some code optimization or a reduction in the overall package size. The release date also indicates the newer version was released roughly a month after the previous one.
For developers, the impact of upgrading from 2.1.2 to 2.1.3 might be minimal unless you're encountering specific issues related to path handling or have a strong reason to stay on the older version. The shared dependencies like braces, is-glob, anymatch, and fsevents signify that the core file watching functionality remains consistent. Always test after updating any dependency to ensure compatibility for each use case to minimise the risk of breaking changes.
All the vulnerabilities related to the version 2.1.3 of the package
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.
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.