Commit 90b1aa0
committed
fix: prevent command injection in example URL opening
Replace platform-specific subprocess calls with webbrowser.open() and
add URL scheme validation to the elicitation example client.
The previous Windows code path used shell=True with subprocess, which
allowed command injection via crafted URLs containing shell
metacharacters (e.g., & as a command separator in cmd.exe).
Changes:
- Remove subprocess/sys imports, use webbrowser.open() for all platforms
- Add URL scheme allowlist (http/https only) to prevent abuse via
dangerous protocol handlers (file://, smb://, ms-msdt://, etc.)
- Align with the safe pattern already used in the OAuth example client1 parent fc57c2c commit 90b1aa0
1 file changed
+9
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| |||
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
124 | 125 | | |
125 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
126 | 131 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
0 commit comments