Skip to content

fix: guard wildcard stars inside repeated extglobs - #272

Open
GraduErd wants to merge 1 commit into
micromatch:masterfrom
GraduErd:fix/repeated-wildcard-extglob-guard
Open

GraduErd wants to merge 1 commit into
micromatch:masterfrom
GraduErd:fix/repeated-wildcard-extglob-guard

Conversation

@GraduErd

Copy link
Copy Markdown

Problem

+(*a) and similar repeated extglobs put an unbounded wildcard inside an unbounded repeat. analyzeRepeatedExtglob does not reject these single-branch shapes, so a short near-miss can block the event loop. This targets the public GHSA-fc5q-39xc-vjpf / CVE-2026-112366 advisory.

Proposed mitigation

Detect wildcard stars in the extglob body and use the existing literal fallback for repeated +() / *() groups. The scan skips escaped, quoted and bracketed stars, and leaves *(...) syntax to the existing nested-extglob analysis. The new guard remains active with maxExtglobRecursion: false; that option keeps its existing behavior for the other recursion/alternation guards.

Related proposals include #269 and #270. This is a conservative literal-fallback alternative, rather than a claim of a new issue or a semantics-preserving collapse. Maintainer feedback on the compatibility policy is welcome.

Compatibility

Wildcard-containing repeated groups now match their syntax literally, including +(*)c, *(a*|b) and the repeated group in */*(W*, *)*. Four existing test groups are updated explicitly for this change; literal-parenthesis examples also test the bracket-escaped equivalent. Ordinary globs, fixed alternatives, non-repeated extglobs and escaped/quoted/bracketed stars retain their behavior. The README explains the guard and its relationship to the recursion option.

This is a mitigation for repeated wildcard stars, not a general guarantee against every regex ambiguity supported by the parser.

Validation

  • The new bounded child-process regression fails on unmodified master with ETIMEDOUT after 5 seconds.
  • The same regression passes with the patch. It covers seven pattern shapes, 10,001-character near-misses, and default, disabled-recursion, capture and Windows options.
  • Added literal-fallback and unaffected-matching tests.
  • Full lint passes; Mocha reports 2,001 passing on Node 24.21.0/macOS arm64.
  • git diff --check passes.

No version bump or lockfile change is included.

@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.

2 participants