Title: [Security] Harden CLI dev command against injection on Windows by RinZ27 · Pull Request #1904 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: [Security] Harden CLI dev command against injection on Windows by RinZ27 · Pull Request #1904 · modelcontextprotocol/python-sdk
X Title: [Security] Harden CLI dev command against injection on Windows by RinZ27 · Pull Request #1904 · modelcontextprotocol/python-sdk
Description: I was looking through the CLI code and spotted a potential security risk when using the mcp dev command on Windows. Because shell=True is required for npx, passing raw arguments can lead to command injection if a user provides a file path containing shell metacharacters. I decided to use shlex.quote to sanitize these arguments before they are joined into the final command string. This way, I ensure that any special characters are safely escaped, keeping the execution restricted to the intended command. I've verified the fix and it correctly handles paths with spaces and other characters.
Open Graph Description: I was looking through the CLI code and spotted a potential security risk when using the mcp dev command on Windows. Because shell=True is required for npx, passing raw arguments can lead to command...
X Description: I was looking through the CLI code and spotted a potential security risk when using the mcp dev command on Windows. Because shell=True is required for npx, passing raw arguments can lead to command...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/1904
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a869aecb-9e11-6973-9a29-b386e27e6dd4 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9B22:10B6B6:A6F7335:DDD033E:696E21C9 |
| html-safe-nonce | 40e57c9bc0e76b744b77a0cef0484dc010a8ae9e0e3afd8038a441c7be45f1e2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjIyOjEwQjZCNjpBNkY3MzM1OkRERDAzM0U6Njk2RTIxQzkiLCJ2aXNpdG9yX2lkIjoiODAzMjg5MjIzMDQyNDIwNzgxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 865951df795e0063c27ed674d5c71697ca35bc324427a23b2fe4e5a358933ebe |
| hovercard-subject-tag | pull_request:3184015299 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/1904/files |
| twitter:image | https://avatars.githubusercontent.com/u/222222878?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/222222878?s=400&v=4 |
| og:image:alt | I was looking through the CLI code and spotted a potential security risk when using the mcp dev command on Windows. Because shell=True is required for npx, passing raw arguments can lead to command... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2fbe8cba5e260284c10af515699ff9bb2d6ace05ab6c2e2e585b71d93b2812c3 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7fb3bc5c995a876085291706b75cf9b08900c338 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width