Skip to content

fix: guard emitted repetition in single-branch extglobs - #274

Open
gdmiller-za wants to merge 2 commits into
micromatch:masterfrom
gdmiller-za:fix/single-branch-repeated-extglob
Open

gdmiller-za wants to merge 2 commits into
micromatch:masterfrom
gdmiller-za:fix/single-branch-repeated-extglob

Conversation

@gdmiller-za

Copy link
Copy Markdown

Summary

Single-branch repeated extglobs such as +(*a) and +(*) can emit nested unbounded regex quantifiers that bypass the existing alternation and recursion analysis (GHSA-fc5q-39xc-vjpf).

Track emitted repetition on private extglob frames and use the existing literal fallback for repeated wildcard branches, generated negation wildcards, and raw regex plus quantifiers. Carry surviving repetition depth through wrappers, and discard metadata when a child has been literalized. Existing safe character-class rewrites and the explicit maxExtglobRecursion: false opt-out remain available.

This is a conservative security boundary: some complex nested patterns now match literally. Compatibility tests explicitly cover the new default and the previous behavior with the opt-out; README describes the change. No claim is made that arbitrary user-supplied regex syntax is universally safe.

Validation

  • Full upstream npm test: 2,004 passing, including lint.
  • Timeout-bounded child-process regressions cover wildcard, negated, wrapped, and regex-quantified branches with capture, Windows, bash, and fast-path options.
  • Escaped, quoted, and bracketed literal stars remain supported.
  • Child fallback metadata and numeric recursion allowance have regression coverage.

The opt-out is exercised only with short trusted inputs; hostile inputs are always run in a separate bounded process.

@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