Skip to content

Commit 4e3875c

Browse files
authored
Add CodeQL suppressions for PowerShell intended behavior (PowerShell#25359)
1 parent dd1fb91 commit 4e3875c

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ private void LoadAssemblies(IEnumerable<string> assemblies)
684684
{
685685
// CoreCLR doesn't allow re-load TPA assemblies with different API (i.e. we load them by name and now want to load by path).
686686
// LoadAssemblyHelper helps us avoid re-loading them, if they already loaded.
687+
// codeql[cs/dll-injection-remote] - This is expected PowerShell behavior and integral to the purpose of the class. It allows users to load any C# dependencies they need for their PowerShell application and add other types they require.
687688
Assembly assembly = LoadAssemblyHelper(assemblyName) ?? Assembly.LoadFrom(ResolveAssemblyName(assemblyName, false));
688689

689690
if (PassThru)

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
@@ -1771,6 +1771,7 @@ private static StringContent GetMultipartStringContent(object fieldName, object
17711771
ContentDispositionHeaderValue contentDisposition = new("form-data");
17721772
contentDisposition.Name = LanguagePrimitives.ConvertTo<string>(fieldName);
17731773

1774+
// codeql[cs/information-exposure-through-exception] - PowerShell is an on-premise product, meaning local users would already have access to the binaries and stack traces. Therefore, the information would not be exposed in the same way it would be for an ASP .NET service.
17741775
StringContent result = new(LanguagePrimitives.ConvertTo<string>(fieldValue));
17751776
result.Headers.ContentDisposition = contentDisposition;
17761777

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,7 @@ private static Assembly LoadAssembly(string name, string filePath, out Exception
13851385
{
13861386
try
13871387
{
1388+
// codeql[cs/dll-injection-remote] - The dll is loaded during the initial state setup, which is expected behavior. This allows users hosting PowerShell to load additional C# types to enable their specific scenarios.
13881389
loadedAssembly = Assembly.LoadFrom(filePath);
13891390
return loadedAssembly;
13901391
}

0 commit comments

Comments
 (0)