Commit dc1cf19
committed
fix: remove shell=True from subprocess calls in mcp dev (command injection risk)
Remove shell=True from _get_npx_command() and the MCP Inspector
subprocess.run() call. On Windows, _get_npx_command() already resolves
to the correct .cmd/.exe extension, so shell=True is unnecessary and
exposes a command injection risk via shell metacharacters in file paths.
Also catch FileNotFoundError in _get_npx_command() for robustness when
the command is not found without shell expansion.1 parent 62575ed commit dc1cf19
1 file changed
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
275 | | - | |
| 274 | + | |
276 | 275 | | |
277 | 276 | | |
278 | 277 | | |
279 | | - | |
280 | 278 | | |
281 | 279 | | |
282 | 280 | | |
| |||
0 commit comments