Skip to content

fix: bound single-branch repeated wildcard extglobs - #269

Open
loomlogic-io wants to merge 1 commit into
micromatch:masterfrom
loomlogic-io:fix/cve-2026-112366
Open

loomlogic-io wants to merge 1 commit into
micromatch:masterfrom
loomlogic-io:fix/cve-2026-112366

Conversation

@loomlogic-io

Copy link
Copy Markdown

A single-branch repeated wildcard such as +(*a) nests an unbounded wildcard inside an unbounded repeat. The stock 4.0.7 parser times out on a 50,001-character negative match in an isolated child process.

This proposal removes the redundant outer repetition when the branch is closed under concatenation over non-separator characters: +(X) becomes one X, and *(X) becomes an optional X. Complex wildcard bodies, capture/contains modes, raw-regex mode and surrounding capture contexts use the existing literal safeguard instead. The wildcard check remains active when maxExtglobRecursion is disabled; that option's behavior for other extglob forms is unchanged. Parsed collapsed states reject capture/contains changes at compileRe, so callers must reparse with those options.

Validation: npm test passes 2,003 tests on Node 26.12.1/macOS arm64. All 1,998 existing tests are unchanged. Five added tests cover exhaustive short-input matching comparisons, Windows separators/Unicode/escaped stars, literal fallbacks, parse/compile option changes, and 50,001-character attacks across ten option configurations in 64 MB children with one-second deadlines. The stock 4.0.7 attack reproduces the timeout. git diff --check passes.

Compatibility and scope: guarded complex patterns can match literally, and changing capture/contains after parsing a collapsed expression throws a SyntaxError. This is a focused proposal for the reported repeated-wildcard class, not a general proof against every possible regex ambiguity; broader extglob ambiguity and existing opt-outs for other forms need separate review. Please review the compatibility policy and CVE coverage before an official release.

Related advisory: GHSA-fc5q-39xc-vjpf (CVE-2026-112366). No package version is changed and no official npm release is claimed.

@WKilliam

Copy link
Copy Markdown

I'd really like to see this PR merged. This issue is quite blocking on my side, so having a fix for it would make a real difference.

The approach looks promising, and I appreciate the work put into the regression tests and compatibility safeguards.

Hopefully a maintainer can review and approve it soon. I'd be happy to see this included in an official release!

Thanks for working on this!

@G-Rath

G-Rath commented Nov 18, 2026

Copy link
Copy Markdown

Both GitHub and VulnCheck have withdrawn this advisory, as it is not a security issue.

If a tool is still reporting you're "vulnerable", then you need to contact the tool author about getting their source updated.

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.

3 participants