Skip to content

Renovate: dependency wcmatch to v11 [SECURITY] - #717

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/pypi-wcmatch-vulnerability
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/pypi-wcmatch-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
wcmatch 10.1 → 11.2 age confidence

wcmatch: Polynomial-time ReDoS when matching untrusted names against multi-star patterns (default flags)

CVE-2026-132276 / GHSA-53pm-wgxf-c6qf

More information

Details

Summary

With default flags, a pattern that contains several * wildcards takes polynomial time, O(n^k) for k stars, to reject a crafted file name. The pattern is an ordinary developer constant such as *_*_*_*_*.csv; only the string being matched comes from the attacker. A 255-byte file name (the maximum on common filesystems) takes 73 s with fnmatch.fnmatch() and 86 s with glob.globmatch(). The standard library's fnmatch handles the same input in under a millisecond.

This is different from GHSA-84v8-qmgq-9g88: that advisory covers extglob patterns, while this case needs no flags and no attacker-controlled pattern.

Details

Every * is translated to a lazy .*? (_STAR, wcmatch/_wcparse.py:212; _PATH_STAR [^/]*?, :218), which is emitted in _handle_star (:1405-1424):

*_*_*_*_*.csv  ->  ^(?s:(?=.)(?![.]).*?_.*?_.*?_.*?_.*?\.csv)$

When the subject consists of many _ and does not end in .csv, the regex engine tries every way of splitting it between the stars. CPython fixed the same problem in its own fnmatch (bpo-40480) by making every star segment except the last one atomic.

PoC
import time, fnmatch as std
from wcmatch import fnmatch, glob

for pat, n in [('*_*_*_*.csv', 255), ('*_*_*_*.csv', 400), ('*_*_*_*_*.csv', 150),
               ('*_*_*_*_*.csv', 200), ('*_*_*_*_*.csv', 255)]:
    name = '_' * n
    t = time.perf_counter(); fnmatch.fnmatch(name, pat); w = time.perf_counter() - t
    t = time.perf_counter(); std.fnmatchcase(name, pat); s = time.perf_counter() - t
    print(f'{pat:15} len={n}  wcmatch={w:.3f}s  stdlib={s:.5f}s')

t = time.perf_counter(); glob.globmatch('uploads/' + '_' * 255, 'uploads/*_*_*_*_*.csv')
print(f'globmatch {time.perf_counter() - t:.2f}s')

wcmatch 11.1, CPython 3.13, macOS:

*_*_*_*.csv     len=255  wcmatch=1.412s   stdlib=0.00001s
*_*_*_*.csv     len=400  wcmatch=8.599s   stdlib=0.00004s
*_*_*_*_*.csv   len=150  wcmatch=5.333s   stdlib=0.00003s
*_*_*_*_*.csv   len=200  wcmatch=22.415s  stdlib=0.00007s
*_*_*_*_*.csv   len=255  wcmatch=72.732s  stdlib=0.00047s
globmatch 85.75s

glob.glob('*_*_*_*.csv', root_dir=d) on a real directory that contains one file named '_' * 255 takes 1.7 s.

Impact

Applications that match untrusted names against multi-star patterns can be blocked on a single CPU core for minutes per name. Examples: upload handlers, archive or object-store key filters, and glob/WcMatch scans of directories where other users can create files. No authentication is needed.

Fix

Emit every star segment except the last one as an atomic group, as the standard library does. On Python 3.11 and later use (?>.*?_); on 3.10 use the lookahead/backreference form from fnmatch._join_translated_parts. For example:

^(?s:(?=.)(?![.])(?>.*?_)(?>.*?_)(?>.*?_)(?>.*?_).*?\.csv)$

This rejects the 255-byte name in under 1 ms. On my spot-check inputs it gives the same results as the current regex. The same change applies to _PATH_STAR.

Severity

  • CVSS Score: 5.9 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

facelessuser/wcmatch (wcmatch)

v11.2

Compare Source

11.2

  • NEW: Drop support for Python 3.10.
  • FIX: Require bracex 3.2 for various bug fixes.
  • FIX: Filter filename iterables without evaluating their "truthiness", allowing collections such as numpy
    arrays (@​Lushiyao5).
  • FIX: Improve performance when multiple * are used for file name matching. Performance is only improved in
    cases where variable length EXTGLOB patterns would not interfere with matching. Issue found by (@​gistrec).
  • FIX: Apply one pattern limit to includes and exclusions when scanning with glob and iglob, and preserve
    unlimited expansion across multiple patterns with negative limits.
  • FIX: Use the documented default limit of 1000 patterns in WcMatch instead of 32.
  • FIX: Preserve unlimited pattern expansion with exclusions in compiled matchers and translation, and enforce
    finite limits when exclusions consume the entire pattern budget.
  • FIX: Fix an invalid regular expression error when an EXTGLOB/EXTMATCH inverse group, !(...), is followed
    by an extended group that contains another extended group, e.g. !(a)@(b|*(c)).
  • FIX: Fix an EXTGLOB/EXTMATCH star group, *(...), being matched as literal text when it directly follows
    another *, e.g. a**(b).
  • FIX: Fix glob and iglob returning the same path twice when two patterns find it and case is ignored, e.g.
    ['A*', '*b'] with IGNORECASE and a file named Ab. Files that only differ by case are no longer treated as
    duplicates when the file system is case sensitive.
  • FIX: According to Bash, a file name that starts with an extended group should never match . or ...
  • FIX: Preserve leading-dot restrictions for wildcards after extended groups that can match an empty string,
    such as ?(a)*, and avoid returning . and .. from these directory scans.
  • FIX: Fix rglob treating a pattern that starts with ** or *** as if it started with *, e.g. **/a.txt
    with GLOBSTAR missed a.txt in the searched folder and returned a.txt from inside a symlinked folder.

v11.1

Compare Source

11.1

  • NEW: Add support for Python 3.15.
  • FIX: Fix WindowsPath subclass construction on Python 3.12+ (#​238).
  • FIX: Fix symlink prefixes for multiple GLOBSTAR captures (#​239).

v11.0.1

Compare Source

11.0.1

  • DOCS: Provide information in documentation that discloses information about what should or should not be
    expected from Wildcard Match in regards to security, and provide general information to allow users to make good
    decisions.
  • FIX: Fix an issue where in some cases dot handling was not correct within an extended glob pattern when
    EXTGLOB/EXTMATCH was enabled.

v11.0

Compare Source

11.0

  • NEW: Reduce/combine nested EXTGLOB/EXTMATCH regular expression patterns when possible to reduce deeply
    nested patterns.
  • NEW: Added ZSH style numerical ranges (<0-9>) via new NUMRANGE flag.
  • BREAK: Previously, translation would have a capture group for every extended glob pattern when
    EXTGLOB/EXTMATCH was enabled. Due to the new feature added that reduces extended glob group nesting, groups no
    longer appear exactly as specified. Moving forward, capturing groups are not included by default. If you need the
    old behavior, it can be enabled in a translate() call via the CAPTURE flag. This flag will cause extended glob
    reduction to be turned off and for capturing groups to be enabled.
  • FIX: Avoid reparsing sequences that have already been deemed not valid.
  • FIX: Halt EXTGLOB/EXTMATCH parsing once an unclosed extended glob pattern is encountered.
  • FIX: Fix case where an empty string would not match a pattern targeting an empty string.
  • FIX: Ensure that consecutive stars are collapsed into a single regular expression pattern.
  • FIX: Fix parsing SPLIT not accounting for POSIX character class.

v10.2.1

Compare Source

10.2.1

  • FIX: Properly update project requirements to ensure usage of bracex 3.0.

v10.2

Compare Source

10.2

  • NEW: Require bracex 3.0 for bug fixes.
  • NEW: Drop support for Python 3.9 which is "end of life".

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added the renovate label Nov 21, 2026
@renovate
renovate Bot requested a review from a team November 21, 2026 03:05
@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.27%. Comparing base (367da69) to head (2d1099b).

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #717       +/-   ##
===========================================
+ Coverage   78.12%   89.27%   +11.14%     
===========================================
  Files          71       81       +10     
  Lines        3612     4131      +519     
===========================================
+ Hits         2822     3688      +866     
+ Misses        790      443      -347     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants