Skip to content

Prevent stack exhaustion in deeply nested braces patterns - #425

Merged
lisagorewitdecker merged 7 commits into
mainfrom
copilot/fix-braces-vulnerability-27
Oct 7, 2026
Merged

lisagorewitdecker merged 7 commits into
mainfrom
copilot/fix-braces-vulnerability-27

Conversation

Copilot AI commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary

The transitive braces@3.0.3 parser allows deeply nested patterns that can exhaust the stack during recursive AST processing. This change caps nesting and AST traversal at 100 and rejects cyclic expansion parent chains.

  • Mitigation: Patch braces through pnpm’s patched-dependency mechanism and update the lockfile.
  • Coverage: Add regressions for deeply nested patterns, ASTs, and cyclic parent chains.

API compatibility

API_BREAKING_CHANGE_JUSTIFICATION:
API_BREAKING_CHANGE_MIGRATION_PLAN:

Copilot AI and others added 3 commits October 7, 2026 20:23
Co-authored-by: lisagorewitdecker <50784106+lisagorewitdecker@users.noreply.github.com>
Co-authored-by: lisagorewitdecker <50784106+lisagorewitdecker@users.noreply.github.com>
Co-authored-by: lisagorewitdecker <50784106+lisagorewitdecker@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

The mitigation, lockfile metadata, and regression coverage are consistent and complete.

0 open findings

What changed in this PR

Adds a pnpm dependency patch that limits braces@3.0.3 recursion depth and rejects cyclic AST parent chains.

Changes:

  • Caps parsing and AST traversal depth at 100.
  • Updates pnpm patch metadata and lockfile references.
  • Adds security regression tests to the unit suite.
File Description
patches/​braces@3.0.3.patch Implements parser and AST recursion safeguards.
pnpm-workspace.yaml Registers the braces patch.
pnpm-lock.yaml Records patch hash and patched snapshot.
scripts/​tests/​braces-security-patch.test.mjs Tests normal use, excessive depth, and cycles.
package.json Adds the regression tests to test:unit.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Signed-off-by: lisagorewitdecker <50784106+lisagorewitdecker@users.noreply.github.com>
Co-authored-by: lisagorewitdecker <50784106+lisagorewitdecker@users.noreply.github.com>
auto-merge was automatically disabled October 7, 2026 20:52

Head branch was pushed to by a user without write access

Copilot AI and others added 2 commits October 7, 2026 20:57
Co-authored-by: lisagorewitdecker <50784106+lisagorewitdecker@users.noreply.github.com>
Co-authored-by: lisagorewitdecker <50784106+lisagorewitdecker@users.noreply.github.com>
@lisagorewitdecker
lisagorewitdecker merged commit 418d577 into main Oct 7, 2026
29 checks passed
@lisagorewitdecker
lisagorewitdecker deleted the copilot/fix-braces-vulnerability-27 branch October 8, 2026 13:51
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