We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7628b30 commit d8f1bf8Copy full SHA for d8f1bf8
1 file changed
samples/ProtectedMcpClient/Program.cs
@@ -134,6 +134,13 @@
134
/// <param name="url">The URL to open.</param>
135
static void OpenBrowser(Uri url)
136
{
137
+ // Validate the URI scheme - only allow safe protocols
138
+ if (url.Scheme != Uri.UriSchemeHttp && url.Scheme != Uri.UriSchemeHttps)
139
+ {
140
+ Console.WriteLine($"Error: Only HTTP and HTTPS URLs are allowed.");
141
+ return;
142
+ }
143
+
144
try
145
146
var psi = new ProcessStartInfo
@@ -145,7 +152,7 @@ static void OpenBrowser(Uri url)
152
}
153
catch (Exception ex)
147
154
148
- Console.WriteLine($"Error opening browser. {ex.Message}");
155
+ Console.WriteLine($"Error opening browser: {ex.Message}");
149
156
Console.WriteLine($"Please manually open this URL: {url}");
150
157
151
158
0 commit comments