Skip to content

Commit 34f6e26

Browse files
authored
Add CodeQL suppressions for NativeCommandProcessor (PowerShell#26729)
1 parent 8489f8f commit 34f6e26

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ private void InitNativeProcess()
831831
bool useSpecialArgumentPassing = UseSpecialArgumentPassing(oldFileName);
832832
if (useSpecialArgumentPassing)
833833
{
834+
// codeql[cs/microsoft/command-line-injection] - This is expected PowerShell behavior where user inputted paths are supported for the context of this method and the path portion of the argument is escaped. The user assumes trust for the file path specified on the user's system to start process for, and in the case of remoting, restricted remoting security guidelines should be used.
834835
startInfo.Arguments = "\"" + oldFileName + "\" " + startInfo.Arguments;
835836
}
836837
else
@@ -855,7 +856,7 @@ private void InitNativeProcess()
855856
startInfo.ArgumentList.RemoveAt(0);
856857
}
857858

858-
// 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.
859+
// codeql[cs/microsoft/command-line-injection-shell-execution] - This is expected PowerShell 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.
859860
startInfo.FileName = oldFileName;
860861
}
861862
}
@@ -1607,7 +1608,7 @@ private ProcessStartInfo GetProcessStartInfo(
16071608
{
16081609
var startInfo = new ProcessStartInfo
16091610
{
1610-
// 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.
1611+
// codeql[cs/microsoft/command-line-injection-shell-execution] - This is expected PowerShell 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.
16111612
FileName = this.Path
16121613
};
16131614

0 commit comments

Comments
 (0)