Skip to content

Commit cd24011

Browse files
anamnaviSIRMARGIN
authored andcommitted
Add Codeql Suppressions (PowerShell#25943)
1 parent 420b7c3 commit cd24011

5 files changed

Lines changed: 5 additions & 0 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,7 @@ protected override void BeginProcessing()
19031903
}
19041904
catch (CommandNotFoundException)
19051905
{
1906+
// 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.
19061907
startInfo.FileName = FilePath;
19071908
#if UNIX
19081909
// 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
@@ -1295,6 +1295,7 @@ internal virtual HttpResponseMessage GetResponse(HttpClient client, HttpRequestM
12951295
WriteWebRequestDebugInfo(currentRequest);
12961296
}
12971297

1298+
// 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.
12981299
response = client.SendAsync(currentRequest, HttpCompletionOption.ResponseHeadersRead, _cancelToken.Token).GetAwaiter().GetResult();
12991300

13001301
if (IsWriteVerboseEnabled())

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,7 @@ private ProcessStartInfo GetProcessStartInfo(
16051605
{
16061606
var startInfo = new ProcessStartInfo
16071607
{
1608+
// 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.
16081609
FileName = this.Path
16091610
};
16101611

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

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

2275+
// 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.
22752276
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(filePath);
22762277

22772278
// 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)