Skip to content

Commit d5267d2

Browse files
authored
Add CodeQL suppressions for UpdatableHelp and NativeCommandProcessor methods (#26132)
1 parent 31cd731 commit d5267d2

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,8 @@ private void InitNativeProcess()
854854
{
855855
startInfo.ArgumentList.RemoveAt(0);
856856
}
857+
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.
857859
startInfo.FileName = oldFileName;
858860
}
859861
}

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)