Skip to content

fix: prevent command injection in example URL opening (v1.x backport)#1579

Merged
felixweinberger merged 1 commit intov1.xfrom
fix/example-command-injection-v1x
Feb 24, 2026
Merged

fix: prevent command injection in example URL opening (v1.x backport)#1579
felixweinberger merged 1 commit intov1.xfrom
fix/example-command-injection-v1x

Conversation

@maxisbey
Copy link
Contributor

Backport of #1553 to v1.x.

Removes the use of exec() with string interpolation to open URLs in elicitationUrlExample.ts and simpleOAuthClient.ts, which allowed command injection via crafted URLs.

Rather than adding the open npm package (as #1553 does on main), this takes a simpler approach: remove the auto-open behavior entirely and print the URL for the user to open manually. On v1.x there is no separate examples package, so adding open would introduce a new runtime dependency on the published SDK. Since the examples already handle waiting via HTTP callbacks and MCP notifications (not the browser process), this change has no effect on functionality.

AI Disclaimer

@maxisbey maxisbey requested review from a team as code owners February 24, 2026 14:56
@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

⚠️ No Changeset found

Latest commit: 978b6cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/sdk@1579

commit: 978b6cc

Copy link
Contributor

@felixweinberger felixweinberger left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! LGTM

@felixweinberger felixweinberger merged commit e79d14a into v1.x Feb 24, 2026
9 checks passed
@felixweinberger felixweinberger deleted the fix/example-command-injection-v1x branch February 24, 2026 17:06
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