Fix the TPA in a more reliable way - #115
Open
Dongbo Wang (daxian-dbw) wants to merge 1 commit into
Open
Dongbo Wang (daxian-dbw) wants to merge 1 commit into
Dongbo Wang (daxian-dbw) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
/azp run |
|
Commenter does not have sufficient privileges for PR 115 in repo PowerShell/PowerShell-Native |
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Fix #114
Replace the hard-coded Trusted Platform Assemblies (TPA) allow-list used by
pwrshplugin.dllwith a deny-list constructed from the DLLs installed alongside .NET runtime.Motivation
The set of trusted platform assemblies differs across supported PowerShell versions, including 7.4, 7.5, and 7.6. Maintaining an explicit allow-list causes the WinRM hosting code to fall out of sync as assemblies are added, removed, or renamed.
Comparing
TRUSTED_PLATFORM_ASSEMBLIESfrompwsh.exewith the DLLs under$PSHOMEshowed that the TPA list is consistently the set of installed DLLs minus a relatively stable group of native and host binaries.Changes
*.dllfiles immediately undercoreCLRDirectoryPath.mscordaccore_to account for architecture- and version-specific filenames.Microsoft.PowerShell.GraphicalHost.dll, which is not usable in a remoting session..ni.dllprobing logic because modern PowerShell distributions no longer include native-image assemblies.FindFirstFileA,FindNextFileA, andFindCloseto the existing system-call facade so directory enumeration follows the current dependency-injection design.This makes TPA construction resilient to assembly changes across PowerShell and .NET servicing releases while retaining a small, stable deny-list.