Fix the TPA in a more reliable way - #115
Merged
Aditya Patwardhan (adityapatwardhan) merged 2 commits intoSep 17, 2026
Merged
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). |
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
5 tasks
Aditya Patwardhan (adityapatwardhan)
requested changes
Sep 17, 2026
| "clrjit.dll", | ||
| "coreclr.dll", | ||
| "D3DCompiler_47_cor3.dll", | ||
| "getfilesiginforedist.dll", |
There was a problem hiding this comment.
Also this "getfilesiginforedistwrapper.dll" ?
Member
Author
There was a problem hiding this comment.
getfilesiginforedistwrapper.dll is included in the TPA list of pwsh.exe, so it's not excluded here. You can find it by running [AppContext]::GetData('TRUSTED_PLATFORM_ASSEMBLIES') from pwsh.
I compared the new TPAs in the plugin and those in pwsh.exe (7.4.20, 7.5.11, and 7.6.6), only 2 are intentionally excluded from the plugin:
- Microsoft.PowerShell.GraphicalHost.dll
- pwsh.dll
Aditya Patwardhan (adityapatwardhan)
approved these changes
Sep 17, 2026
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Aditya Patwardhan (adityapatwardhan)
merged commit Sep 17, 2026
0e619ce
into
PowerShell:master
12 of 13 checks passed
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
Also fix the following PowerShell issues:
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.