From e1242eefdab4b45bbb0dcc00406e727415290e16 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 14 Jun 2025 17:07:45 +0800 Subject: [PATCH] Check Process.Start usage --- Flow.Launcher.Infrastructure/Win32Helper.cs | 1 + Flow.Launcher/App.xaml.cs | 2 +- Flow.Launcher/PublicAPIInstance.cs | 9 +-------- .../Helper/ResultHelper.cs | 1 + 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Win32Helper.cs b/Flow.Launcher.Infrastructure/Win32Helper.cs index d24db1718..52ddb6dc9 100644 --- a/Flow.Launcher.Infrastructure/Win32Helper.cs +++ b/Flow.Launcher.Infrastructure/Win32Helper.cs @@ -674,6 +674,7 @@ namespace Flow.Launcher.Infrastructure { try { + // No need to de-elevate since we are opening windows settings which cannot bring security risks Process.Start(new ProcessStartInfo("ms-settings:regionlanguage") { UseShellExecute = true }); } catch (System.Exception) diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index ef8d52e22..4c05ea5f1 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -367,7 +367,7 @@ namespace Flow.Launcher UseShellExecute = true, Verb = Win32Helper.IsAdministrator() || forceAdmin ? "runas" : "" }; - Process.Start(startInfo); + Process.Start(startInfo); // No need to de-elevate since we are restarting Thread.Sleep(500); Environment.Exit(0); diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index d2ac75c66..bdf719c72 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -404,7 +404,6 @@ namespace Flow.Launcher } } - private void OpenUri(Uri uri, bool? inPrivate = null) { if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps) @@ -438,13 +437,7 @@ namespace Flow.Launcher } else { - Process.Start(new ProcessStartInfo() - { - FileName = uri.AbsoluteUri, - UseShellExecute = true - })?.Dispose(); - - return; + StartProcess(uri.AbsoluteUri, arguments: null, useShellExecute: true); } } diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs index 9e85a8580..e1bdd2462 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs @@ -198,6 +198,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper try { + // No need to de-elevate since we are opening windows settings which cannot bring security risks Process.Start(processStartInfo); return true; }