Skip to content

Commit b2d043a

Browse files
pwshBotanamnaviTravisEz13
authored
[release/v7.4] Add Codeql Suppressions (#25973)
Co-authored-by: Anam Navied <anam.naviyou@gmail.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
1 parent 98f26c6 commit b2d043a

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
@@ -1926,6 +1926,7 @@ protected override void BeginProcessing()
19261926
}
19271927
catch (CommandNotFoundException)
19281928
{
1929+
// 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.
19291930
startInfo.FileName = FilePath;
19301931
#if UNIX
19311932
// 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
@@ -1397,6 +1397,7 @@ private ProcessStartInfo GetProcessStartInfo(
13971397
{
13981398
var startInfo = new ProcessStartInfo
13991399
{
1400+
// 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.
14001401
FileName = this.Path
14011402
};
14021403

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
@@ -1324,6 +1324,7 @@ protected override void InvokeDefaultAction(string path)
13241324
if (ShouldProcess(resource, action))
13251325
{
13261326
var invokeProcess = new System.Diagnostics.Process();
1327+
// 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.
13271328
invokeProcess.StartInfo.FileName = path;
13281329
#if UNIX
13291330
bool useShellExecute = false;

0 commit comments

Comments
 (0)