Skip to content

Commit 434f880

Browse files
pwshBotanamnaviTravisEz13
authored
[release/v7.5] Add Codeql Suppressions (#25972)
Co-authored-by: Anam Navied <anam.naviyou@gmail.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
1 parent d03f807 commit 434f880

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,6 +1904,7 @@ protected override void BeginProcessing()
19041904
}
19051905
catch (CommandNotFoundException)
19061906
{
1907+
// codeql[cs/microsoft/command-line-injection-shell-execution] - This is expected Poweshell behavior where user inputted paths are supported for the context of this method. The user assumes trust for the file path they are specifying and the process is on the user's system except for remoting in which case restricted remoting security guidelines should be used.
19071908
startInfo.FileName = FilePath;
19081909
#if UNIX
19091910
// Arguments are passed incorrectly to the executable used for ShellExecute and not to filename https://github.com/dotnet/corefx/issues/30718

src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,7 @@ internal virtual HttpResponseMessage GetResponse(HttpClient client, HttpRequestM
12961296
_cancelToken = new CancellationTokenSource();
12971297
try
12981298
{
1299+
// codeql[cs/ssrf] - This is expected Poweshell behavior where user inputted Uri is supported for the context of this method. The user assumes trust for the Uri and invocation is done on the user's machine, not a web application. If there is concern for remoting, they should use restricted remoting.
12991300
response = client.SendAsync(currentRequest, HttpCompletionOption.ResponseHeadersRead, _cancelToken.Token).GetAwaiter().GetResult();
13001301
}
13011302
catch (TaskCanceledException ex)

src/System.Management.Automation/engine/NativeCommandProcessor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,7 @@ private ProcessStartInfo GetProcessStartInfo(
13961396
{
13971397
var startInfo = new ProcessStartInfo
13981398
{
1399+
// codeql[cs/microsoft/command-line-injection-shell-execution] - This is expected Poweshell behavior where user inputted paths are supported for the context of this method. The user assumes trust for the file path specified on the user's system to retrieve process info for, and in the case of remoting, restricted remoting security guidelines should be used.
13991400
FileName = this.Path
14001401
};
14011402

src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,7 @@ internal int StartSSHProcess(
22302230
// linux|macos:
22312231
// Subsystem powershell /usr/local/bin/pwsh -SSHServerMode -NoLogo -NoProfile
22322232

2233+
// codeql[cs/microsoft/command-line-injection-shell-execution] - This is expected Poweshell behavior where user inputted paths are supported for the context of this method. The user assumes trust for the file path specified, so any file executed in the runspace would be in the user's local system/process or a system they have access to in which case restricted remoting security guidelines should be used.
22332234
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(filePath);
22342235

22352236
// pass "-i identity_file" command line argument to ssh if KeyFilePath is set

src/System.Management.Automation/namespaces/FileSystemProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ protected override void InvokeDefaultAction(string path)
13251325
if (ShouldProcess(resource, action))
13261326
{
13271327
var invokeProcess = new System.Diagnostics.Process();
1328+
// codeql[cs/microsoft/command-line-injection-shell-execution] - This is expected Poweshell behavior where user inputted paths are supported for the context of this method. The user assumes trust for the file path they are specifying. If there is concern for remoting, restricted remoting guidelines should be used.
13281329
invokeProcess.StartInfo.FileName = path;
13291330
#if UNIX
13301331
bool useShellExecute = false;

0 commit comments

Comments
 (0)