Skip to content

Fix ReDoS vulnerabilities in npm dependencies#4

Open
Copilot wants to merge 2 commits intomainfrom
copilot/fix-redos-vulnerability
Open

Fix ReDoS vulnerabilities in npm dependencies#4
Copilot wants to merge 2 commits intomainfrom
copilot/fix-redos-vulnerability

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 2, 2026

Multiple ReDoS (and one DoS) vulnerabilities present in the dependency tree via @modelcontextprotocol/sdk, minimatch, brace-expansion, and an unused axios dependency.

Changes

  • @modelcontextprotocol/sdk: Bumped ^1.0.1^1.25.2 to fix ReDoS (GHSA-8r9q-7v3j-jr4g; affected < 1.25.2)
  • axios: Removed — never imported in code, carried DoS vulnerability (GHSA-43fc-jf86-j433; affected 1.0.0–1.13.4)
  • minimatch / brace-expansion: Added overrides to pin transitive deps to patched versions (^3.1.5 / ^1.1.12) resolving three ReDoS CVEs in the minimatch 3.x chain and GHSA-v6h2-p8h4-qcjw in brace-expansion
"overrides": {
  "minimatch": "^3.1.5",
  "brace-expansion": "^1.1.12"
}

npm audit reports 0 vulnerabilities after these changes.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Summary by Sourcery

Update npm dependencies to address ReDoS and DoS vulnerabilities and ensure a clean security audit.

Bug Fixes:

  • Resolve ReDoS vulnerabilities by upgrading @modelcontextprotocol/sdk and pinning vulnerable transitive packages via overrides.
  • Eliminate a DoS vulnerability by removing the unused axios dependency.

Build:

  • Adjust package.json dependencies and overrides and refresh the lockfile to reflect secure package versions.

…nused axios, add overrides for minimatch and brace-expansion

Co-authored-by: sfosss <147890625+sfosss@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ReDoS vulnerability in Anthropic's MCP TypeScript SDK Fix ReDoS vulnerabilities in npm dependencies Mar 2, 2026
@sfosss sfosss marked this pull request as ready for review April 22, 2026 00:35
Copilot AI review requested due to automatic review settings April 22, 2026 00:35
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 22, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates npm dependencies to remediate ReDoS/DoS vulnerabilities by bumping @modelcontextprotocol/sdk, removing an unused axios dependency, and pinning vulnerable transitive modules minimatch and brace-expansion via package.json overrides, with corresponding lockfile updates.

Flow diagram for npm install behavior with overrides and security fixes

graph TD
  A["Developer runs npm install"] --> B["npm reads package.json dependencies"]
  B --> C["Resolve @modelcontextprotocol/sdk ^1.25.2"]
  B --> D["No axios dependency (removed)"]
  C --> E["Resolve transitive minimatch and brace-expansion"]
  E --> F["Apply overrides: minimatch ^3.1.5"]
  E --> G["Apply overrides: brace-expansion ^1.1.12"]
  F --> H["Install patched minimatch"]
  G --> I["Install patched brace-expansion"]
  H --> J["Generate updated package-lock.json"]
  I --> J
  J --> K["Run npm audit"]
  K --> L["0 vulnerabilities reported"]
Loading

File-Level Changes

Change Details Files
Upgrade @modelcontextprotocol/sdk to a non-vulnerable version and refresh lockfile resolution.
  • Bump @modelcontextprotocol/sdk from ^1.0.1 to ^1.25.2 in runtime dependencies.
  • Update package-lock.json entries for @modelcontextprotocol/sdk and its dependency tree to match the new version.
package.json
package-lock.json
Remove unused axios dependency that carried a DoS vulnerability.
  • Delete axios from dependencies in package.json.
  • Prune axios and its subtree from package-lock.json so it is no longer installed.
package.json
package-lock.json
Pin vulnerable transitive dependencies minimatch and brace-expansion to patched versions using npm overrides.
  • Add an overrides block in package.json to force minimatch to ^3.1.5 and brace-expansion to ^1.1.12.
  • Update package-lock.json to reflect the overridden versions and ensure all references resolve to the patched releases.
package.json
package-lock.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="package.json" line_range="42-45" />
<code_context>
+    "@modelcontextprotocol/sdk": "^1.25.2",
     "dotenv": "^16.3.1"
   },
+  "overrides": {
+    "minimatch": "^3.1.5",
+    "brace-expansion": "^1.1.12"
+  },
   "devDependencies": {
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Use exact versions in `overrides` instead of caret ranges for deterministic behavior.

Using caret ranges here means future `3.x`/`1.x` releases could be pulled in and reintroduce bugs or security issues you’re trying to avoid. Pin these to exact versions (e.g. `"3.1.5"` and `"1.1.12"`) so installs remain stable and reproducible.

```suggestion
  "overrides": {
    "minimatch": "3.1.5",
    "brace-expansion": "1.1.12"
  },
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread package.json
Comment on lines +42 to +45
"overrides": {
"minimatch": "^3.1.5",
"brace-expansion": "^1.1.12"
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (bug_risk): Use exact versions in overrides instead of caret ranges for deterministic behavior.

Using caret ranges here means future 3.x/1.x releases could be pulled in and reintroduce bugs or security issues you’re trying to avoid. Pin these to exact versions (e.g. "3.1.5" and "1.1.12") so installs remain stable and reproducible.

Suggested change
"overrides": {
"minimatch": "^3.1.5",
"brace-expansion": "^1.1.12"
},
"overrides": {
"minimatch": "3.1.5",
"brace-expansion": "1.1.12"
},

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the project’s npm dependency tree to remediate multiple ReDoS/DoS vulnerabilities (and remove an unused vulnerable dependency), resulting in a clean npm audit.

Changes:

  • Bump @modelcontextprotocol/sdk to a patched ^1.25.2 range (lock resolves to 1.27.1).
  • Remove unused axios dependency and regenerate the lockfile.
  • Add npm overrides to force patched minimatch and brace-expansion versions.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
package.json Upgrades @modelcontextprotocol/sdk, removes axios, and adds overrides for minimatch/brace-expansion.
package-lock.json Regenerates dependency tree for the new SDK version and override resolutions; also updates root metadata entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
Comment on lines +43 to +44
"minimatch": "^3.1.5",
"brace-expansion": "^1.1.12"
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

The overrides entries use semver ranges (^3.1.5, ^1.1.12). Since the PR description says these are meant to pin vulnerable transitive dependencies, consider using exact versions here so that regenerating the lockfile can’t silently move to a different (unreviewed) version.

Suggested change
"minimatch": "^3.1.5",
"brace-expansion": "^1.1.12"
"minimatch": "3.1.5",
"brace-expansion": "1.1.12"

Copilot uses AI. Check for mistakes.
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