From 99ea9db33b65d9f024725f573c85c8f6515e3922 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 1 Dec 2022 14:50:18 -0800 Subject: [PATCH 01/12] Update the Trusted_Platform_Assemblies list (#83) --- .../nativemsh/pwrshcommon/pwrshcommon.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp b/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp index 67622f4..43b0f7f 100644 --- a/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp +++ b/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp @@ -668,12 +668,14 @@ namespace NativeMsh // NOTE: The names must not include the .dll extension because it will be added programmatically. static PCSTR trustedAssemblies[] = { + "getfilesiginforedistwrapper", "Markdig.Signed", "Microsoft.ApplicationInsights", + "Microsoft.Bcl.AsyncInterfaces", "Microsoft.CodeAnalysis", "Microsoft.CodeAnalysis.CSharp", "Microsoft.CSharp", - "Microsoft.DiaSymReader.Native.amd64", + "Microsoft.Extensions.ObjectPool", "Microsoft.Management.Infrastructure", "Microsoft.Management.Infrastructure.CimCmdlets", "Microsoft.Management.Infrastructure.Native", @@ -698,7 +700,6 @@ namespace NativeMsh "netstandard", "Newtonsoft.Json", "NJsonSchema", - "PowerShell.Core.Instrumentation", "System", "System.AppContext", "System.Buffers", @@ -730,6 +731,7 @@ namespace NativeMsh "System.Diagnostics.Debug", "System.Diagnostics.DiagnosticSource", "System.Diagnostics.EventLog", + "System.Diagnostics.EventLog.Messages", "System.Diagnostics.FileVersionInfo", "System.Diagnostics.PerformanceCounter", "System.Diagnostics.Process", @@ -746,6 +748,7 @@ namespace NativeMsh "System.Drawing.Primitives", "System.Dynamic.Runtime", "System.Formats.Asn1", + "System.Formats.Tar", "System.Globalization", "System.Globalization.Calendars", "System.Globalization.Extensions", @@ -774,7 +777,6 @@ namespace NativeMsh "System.Management.Automation", "System.Memory", "System.Net", - "System.Net.Connections", "System.Net.Http", "System.Net.Http.Json", "System.Net.Http.WinHttpHandler", @@ -784,6 +786,7 @@ namespace NativeMsh "System.Net.NetworkInformation", "System.Net.Ping", "System.Net.Primitives", + "System.Net.Quic", "System.Net.Requests", "System.Net.Security", "System.Net.ServicePoint", @@ -822,8 +825,8 @@ namespace NativeMsh "System.Runtime.Extensions", "System.Runtime.Handles", "System.Runtime.InteropServices", + "System.Runtime.InteropServices.JavaScript", "System.Runtime.InteropServices.RuntimeInformation", - "System.Runtime.InteropServices.WindowsRuntime", "System.Runtime.Intrinsics", "System.Runtime.Loader", "System.Runtime.Numerics", @@ -860,6 +863,7 @@ namespace NativeMsh "System.ServiceModel.Web", "System.ServiceProcess", "System.ServiceProcess.ServiceController", + "System.Speech", "System.Text.Encoding", "System.Text.Encoding.CodePages", "System.Text.Encoding.Extensions", @@ -882,9 +886,9 @@ namespace NativeMsh "System.ValueTuple", "System.Web", "System.Web.HttpUtility", + "System.Web.Services.Description", "System.Windows", "System.Windows.Extensions", - "System.Windows.Forms", "System.Xml", "System.Xml.Linq", "System.Xml.ReaderWriter", From 6280a698e1e7d149eda7199c2dd10437c9e2a6df Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 7 Dec 2022 11:56:05 -0800 Subject: [PATCH 02/12] Remove wsman client libraries from the `Microsoft.PowerShell.Native` NuGet package (#84) --- build.psm1 | 22 +++------------------- tools/releaseBuild/yaml/nuget.yml | 12 +----------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/build.psm1 b/build.psm1 index d4f090b..4569b19 100644 --- a/build.psm1 +++ b/build.psm1 @@ -529,11 +529,7 @@ function Start-BuildPowerShellNativePackage [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Leaf})] - [string] $macOSZipPath, - - [Parameter(Mandatory = $true)] - [ValidateScript({Test-Path $_ -PathType Leaf})] - [string] $psrpZipPath + [string] $macOSZipPath ) if(-not (Test-Path $PackageRoot)) @@ -554,7 +550,6 @@ function Start-BuildPowerShellNativePackage $BinFolderLinuxARM64 = Join-Path $tempExtractionPath "LinuxARM64" $BinFolderLinuxAlpine = Join-Path $tempExtractionPath "LinuxAlpine" $BinFolderMacOS = Join-Path $tempExtractionPath "MacOS" - $BinFolderPSRP = Join-Path $tempExtractionPath "PSRP" Expand-Archive -Path $WindowsX64ZipPath -DestinationPath $BinFolderX64 -Force Expand-Archive -Path $WindowsX86ZipPath -DestinationPath $BinFolderX86 -Force @@ -565,11 +560,10 @@ function Start-BuildPowerShellNativePackage Expand-Archive -Path $LinuxARMZipPath -DestinationPath $BinFolderLinuxARM -Force Expand-Archive -Path $LinuxARM64ZipPath -DestinationPath $BinFolderLinuxARM64 -Force Expand-Archive -Path $macOSZipPath -DestinationPath $BinFolderMacOS -Force - Expand-Archive -Path $psrpZipPath -DestinationPath $BinFolderPSRP -Force PlaceWindowsNativeBinaries -PackageRoot $PackageRoot -BinFolderX64 $BinFolderX64 -BinFolderX86 $BinFolderX86 -BinFolderARM $BinFolderARM -BinFolderARM64 $BinFolderARM64 - PlaceUnixBinaries -PackageRoot $PackageRoot -BinFolderLinux $BinFolderLinux -BinFolderLinuxARM $BinFolderLinuxARM -BinFolderLinuxARM64 $BinFolderLinuxARM64 -BinFolderOSX $BinFolderMacOS -BinFolderPSRP $BinFolderPSRP -BinFolderLinuxAlpine $BinFolderLinuxAlpine + PlaceUnixBinaries -PackageRoot $PackageRoot -BinFolderLinux $BinFolderLinux -BinFolderLinuxARM $BinFolderLinuxARM -BinFolderLinuxARM64 $BinFolderLinuxARM64 -BinFolderOSX $BinFolderMacOS -BinFolderLinuxAlpine $BinFolderLinuxAlpine $Nuspec = @' @@ -657,11 +651,7 @@ function PlaceUnixBinaries [Parameter(Mandatory = $true)] [ValidateScript({Test-Path $_ -PathType Container})] - $BinFolderOSX, - - [Parameter(Mandatory = $true)] - [ValidateScript({Test-Path $_ -PathType Container})] - $BinFolderPSRP + $BinFolderOSX ) $RuntimePathLinux = New-Item -ItemType Directory -Path (Join-Path $PackageRoot -ChildPath 'runtimes/linux-x64/native') -Force @@ -675,12 +665,6 @@ function PlaceUnixBinaries Copy-Item "$BinFolderLinuxARM64\*" -Destination $RuntimePathLinuxARM64 -Verbose Copy-Item "$BinFolderLinuxAlpine\*" -Destination $RuntimePathLinuxAlpine -Verbose Copy-Item "$BinFolderOSX\*" -Destination $RuntimePathOSX -Verbose - - ## LinuxARM is not supported by PSRP - Get-ChildItem -Recurse $BinFolderPSRP/*.dylib | ForEach-Object { Copy-Item $_.FullName -Destination $RuntimePathOSX -Verbose } - Get-ChildItem -Recurse $BinFolderPSRP/*.so | ForEach-Object { Copy-Item $_.FullName -Destination $RuntimePathLinux -Verbose } - - Copy-Item $BinFolderPSRP/version.txt -Destination "$PackageRoot/PSRP_version.txt" -Verbose } <# diff --git a/tools/releaseBuild/yaml/nuget.yml b/tools/releaseBuild/yaml/nuget.yml index 3635da0..a45ec90 100644 --- a/tools/releaseBuild/yaml/nuget.yml +++ b/tools/releaseBuild/yaml/nuget.yml @@ -13,15 +13,6 @@ steps: targetPath: "$(System.ArtifactsDirectory)/signed" displayName: Download signed windows native packages -- powershell: | - $null = New-Item $(PackageRoot) -ItemType Directory -Force -Verbose - if(-not (Test-Path '$(System.ArtifactsDirectory)/release' )) - { - New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)/release' -Force - } - Invoke-WebRequest -Uri '$(PSRPBlobUrl)' -OutFile $(System.ArtifactsDirectory)/release/psrp.zip -Verbose - displayName: 'Download PSRP package' - - powershell: 'Get-ChildItem $(System.ArtifactsDirectory)/release' displayName: 'Capture downloaded zips' @@ -80,9 +71,8 @@ steps: $LinuxARM64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-arm64-symbols.zip' $LinuxAlpineZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-x64-symbols.zip' $macOSZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'osx-symbols.zip' - $psrpZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'psrp.zip' - Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath + Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -macOSZipPath $macOSZipPath displayName: 'Collate NuGet package structure' From 06d8c0182051345e72e68965f9d166307bcb347c Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 14 Dec 2022 16:17:42 -0800 Subject: [PATCH 03/12] Hide the console for WinRM remoting (#86) --- .../nativemsh/pwrshplugin/pwrshclrhost.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp b/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp index d2e56e5..69068f3 100644 --- a/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp +++ b/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp @@ -39,6 +39,13 @@ unsigned int PowerShellCoreClrWorker::LaunchClr( { // Allocate a console so that the codepage is setup correctly AllocConsole(); + HWND console = GetConsoleWindow(); + if (console != NULL) + { + // Hide the console window + ShowWindow(console, SW_HIDE); + } + return commonLib->LaunchCoreCLR(hostWrapper, hostEnvironment, friendlyName); } From b6531779dc7f9adf030d9f8c3573cc647bada829 Mon Sep 17 00:00:00 2001 From: Jose Sua Date: Wed, 4 Jan 2023 14:31:59 -0800 Subject: [PATCH 04/12] Moving amsistate event changed to this repo (#87) --- .../PowerShell.Core.Instrumentation.man | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.man b/src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.man index b1c239b..d879924 100644 --- a/src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.man +++ b/src/PowerShell.Core.Instrumentation/PowerShell.Core.Instrumentation.man @@ -2184,6 +2184,18 @@ value="0x6017" version="1" /> +