-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtimeWG-Languageparser, language semanticsparser, language semantics
Description
See #3641. Types needed in PowerShell classes must be available at parse-time (i.e. not loaded with Import-Module or Add-Type) to be able to compile classes to IL.
To be able to resolve these types, we want to support the using assembly statement. However, the most available way to do this involves loading a DLL and possibly executing some of its code, presenting a vector for arbitrary code execution.
Instead, we should analyse a DLL's metadata to discover the types it exports, using a System.Reflection.Metadata.MetadataReader. Example code for this is in PR #3169. The entry point for this analysis would be the PowerShellModuleAssemblyAnalyzer class.
The right way to do this is now to use a MetadataLoadContext
lucahostSeeminglyScience, vexx32, fMichaleczek, ThomasNieto, oising and 1 more
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtimeWG-Languageparser, language semanticsparser, language semantics