Add CodeQL suppressions for NativeCommandProcessor (#26729)

This commit is contained in:
Anam Navied
2026-02-02 16:45:16 -08:00
committed by GitHub
parent 8489f8fc34
commit 34f6e267a4
@@ -831,6 +831,7 @@ namespace System.Management.Automation
bool useSpecialArgumentPassing = UseSpecialArgumentPassing(oldFileName);
if (useSpecialArgumentPassing)
{
// 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.
startInfo.Arguments = "\"" + oldFileName + "\" " + startInfo.Arguments;
}
else
@@ -855,7 +856,7 @@ namespace System.Management.Automation
startInfo.ArgumentList.RemoveAt(0);
}
// 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.
// 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.
startInfo.FileName = oldFileName;
}
}
@@ -1607,7 +1608,7 @@ namespace System.Management.Automation
{
var startInfo = new ProcessStartInfo
{
// 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.
// 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.
FileName = this.Path
};