Skip to content

Update minimatch to 3.1.5 to fix ReDoS vulnerability (GHSA-3ppc-4f35-3m26)#202

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-minimatch-redos-vulnerability
Draft

Update minimatch to 3.1.5 to fix ReDoS vulnerability (GHSA-3ppc-4f35-3m26)#202
Copilot wants to merge 2 commits intomainfrom
copilot/fix-minimatch-redos-vulnerability

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 10, 2026

minimatch 3.1.2 is vulnerable to ReDoS via repeated * wildcards — each compiles to [^/]*?, causing O(4^N) backtracking on non-matching input.

  • Updated transitive dependency minimatch from 3.1.2 → 3.1.5 via npm update minimatch
  • 3.1.5 chosen over 3.1.3 because 3.1.4 also patches a separate ReDoS (nested extglobs, GHSA also filed); both are within the ^3.x semver range required by all consumers

Reachability

Not reachable — high confidence. minimatch is never imported in application source (src/). It exists only as a transitive dep of dev tooling (eslint, glob, test-exclude). Update satisfies scanners; no active exposure.

Pre-existing test failures

Three tests in inputs.test.ts (expect rejections, get resolutions) and secretscanning.test.ts (Jest can't parse ESM from @octokit/action) fail on the base branch. Not related to this change.

Original prompt

This section details the Dependabot vulnerability alert you should resolve

<alert_title>minimatch has a ReDoS via repeated wildcards with non-matching literal in pattern</alert_title>
<alert_description>### Summary
minimatch is vulnerable to Regular Expression Denial of Service (ReDoS) when a glob pattern contains many consecutive * wildcards followed by a literal character that doesn't appear in the test string. Each * compiles to a separate [^/]*? regex group, and when the match fails, V8's regex engine backtracks exponentially across all possible splits.

The time complexity is O(4^N) where N is the number of * characters. With N=15, a single minimatch() call takes ~2 seconds. With N=34, it hangs effectively forever.

Details

Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer.

PoC

When minimatch compiles a glob pattern, each * becomes [^/]*? in the generated regex. For a pattern like ***************X***:

/^(?!\.)[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?X[^/]*?[^/]*?[^/]*?$/

When the test string doesn't contain X, the regex engine must try every possible way to distribute the characters across all the [^/]*? groups before concluding no match exists. With N groups and M characters, this is O(C(N+M, N)) — exponential.

Impact

Any application that passes user-controlled strings to minimatch() as the pattern argument is vulnerable to DoS. This includes:

  • File search/filter UIs that accept glob patterns
  • .gitignore-style filtering with user-defined rules
  • Build tools that accept glob configuration
  • Any API that exposes glob matching to untrusted input

Thanks to @ljharb for back-porting the fix to legacy versions of minimatch.</alert_description>

high
GHSA-3ppc-4f35-3m26, CVE-2026-26996
minimatch
npm
<vulnerable_versions>3.1.2</vulnerable_versions>
<patched_version>3.1.3</patched_version>
<manifest_path>package-lock.json</manifest_path>

https://github.com/isaacs/minimatch/security/advisories/GHSA-3ppc-4f35-3m26 https://github.com/isaacs/minimatch/commit/2e111f3a79abc00fa73110195de2c0f2351904f5 https://nvd.nist.gov/vuln/detail/CVE-2026-26996 https://github.com/advisories/GHSA-3ppc-4f35-3m26

<task_instructions>Resolve this alert by updating the affected package to a non-vulnerable version. Prefer the lowest non-vulnerable version (see the patched_version field above) over the latest to minimize breaking changes. Include a Reachability Assessment section in the PR description. Review the alert_description field to understand which APIs, features, or configurations are affected, then search the codebase for usage of those specific items. If the vulnerable code path is reachable, explain how (which files, APIs, or call sites use the affected functionality) and note that the codebase is actively exposed to this vulnerability. If the vulnerable code path is not reachable, explain why (e.g. the affected API is never called, the vulnerable configuration is not used) and note that the update is primarily to satisfy vulnerability scanners rather than to address an active risk. If the advisory is too vague to determine reachability (e.g. 'improper input validation' with no specific API named), state that reachability could not be determined and explain why. Include a confidence level in the reachability assessment (e.g. high confidence if the advisory names a specific API and you confirmed it is or is not called, low confidence if the usage is indirect and hard to trace). If no patched version is available, check the alert_description field for a Workarounds section — the advisory may describe configuration changes or usage patterns that mitigate the vulnerability without a version update. If a workaround is available, apply it and leave a code comment referencing the advisory identifier explaining it is a temporary mitigation. If neither a patch nor a workaround is available, explain in the PR description why the alert cannot be resolved automatically so a human reviewer can take over. Inspect the repository to determine which package manager is used (e.g. lock files, config files, build scripts) and use that tooling to perform the update — do not edit lock files directly. If the version constraint in the manifest (e.g. package.json, Gemfile, pyproject.toml) caps the version below the fix, update the constraint first. For transitive dependencies, determine whether it is simpler to update the direct dependency that pulls in the vulnerable package or to update the transitive dependency directly, and choose the least disruptive approach. If upgrading to fix the vulnerability forces a major version bump or known breaking changes, review the changelog or release notes, then audit t...

Copilot AI changed the title [WIP] Fix minimatch ReDoS vulnerability in pattern matching Update minimatch to 3.1.5 to fix ReDoS vulnerability (GHSA-3ppc-4f35-3m26) Apr 10, 2026
Copilot AI requested a review from felickz April 10, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants