Skip to content

Commit bb0263d

Browse files
anamnavipwshBot
authored andcommitted
Add CodeQL suppressions for UpdatableHelp and NativeCommandProcessor methods (PowerShell#26132)
1 parent f30fde4 commit bb0263d

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,8 @@ private void InitNativeProcess()
658658
{
659659
startInfo.ArgumentList.RemoveAt(0);
660660
}
661+
662+
// 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.
661663
startInfo.FileName = oldFileName;
662664
}
663665
}

src/System.Management.Automation/help/UpdatableHelpSystem.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ private string ResolveUri(string baseUri, bool verbose)
419419
using (HttpClient client = new HttpClient(handler))
420420
{
421421
client.Timeout = new TimeSpan(0, 0, 30); // Set 30 second timeout
422+
// codeql[cs/ssrf] - This is expected Poweshell behavior and the user assumes trust for the module they download and any URIs it references. The URIs are also not executables or scripts that would be invoked by this method.
422423
Task<HttpResponseMessage> responseMessage = client.GetAsync(uri);
423424
using (HttpResponseMessage response = responseMessage.Result)
424425
{
@@ -783,6 +784,7 @@ private bool DownloadHelpContentHttpClient(string uri, string fileName, Updatabl
783784
using (HttpClient client = new HttpClient(handler))
784785
{
785786
client.Timeout = _defaultTimeout;
787+
// codeql[cs/ssrf] - This is expected Poweshell behavior and the user assumes trust for the module they download and any URIs it references. The URIs are also not executables or scripts that would be invoked by this method.
786788
Task<HttpResponseMessage> responseMsg = client.GetAsync(new Uri(uri), _cancelTokenSource.Token);
787789

788790
// TODO: Should I use a continuation to write the stream to a file?

0 commit comments

Comments
 (0)