Skip to content

Fix brace-expansion vulnerability in mocha dependency#1857

Merged
chagong merged 1 commit intomainfrom
fix/brace-expansion-vulnerability
Apr 14, 2026
Merged

Fix brace-expansion vulnerability in mocha dependency#1857
chagong merged 1 commit intomainfrom
fix/brace-expansion-vulnerability

Conversation

@chagong
Copy link
Copy Markdown
Contributor

@chagong chagong commented Apr 14, 2026

Summary

Fix a vulnerability in brace-expansion (transitive dependency via mocha -> minimatch -> brace-expansion@2.0.2).

Vulnerability

A brace pattern with a zero step value (e.g., {1..2..0}) causes the sequence generation loop to run indefinitely, making the process hang and allocate ~1.9 GB of memory before throwing a RangeError. This affects any application that passes untrusted strings to expand().

Fix

Added brace-expansion override under mocha in package.json to force resolution to >=2.0.3, which sanitizes a step increment of 0 to 1 (matching bash behavior). The resolved version is now 5.0.5.

@chagong chagong requested a review from jdneo April 14, 2026 05:15
@chagong chagong merged commit 7ab23b2 into main Apr 14, 2026
4 checks passed
@chagong chagong deleted the fix/brace-expansion-vulnerability branch April 14, 2026 05:26
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