mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-16 06:39:25 +00:00
<!-- Anything that looks like this is a comment and can't be seen after the Pull Request is created. --> ### PR Summary Add the xsd validation back for CIM cmdlets for PowerShell v7. 1. Instead of baking the huge `.xsd` file in a `.resx` resource file (which is what PS 5.1 does and depends on `System.Windows.Forms`), it's better to directly embed the `.xsd` file in the assembly as resource. 2. Refactored the static constructor of `ScriptWriter` to enable `DtdProcessing.Parse` for PowerShell 7. ---- #### AI description (iteration 1) #### PR Classification This PR fixes a security vulnerability by re-enabling XSD validation for CIM cmdlets to prevent injection attacks in CDXML files. #### PR Summary Restores XSD schema validation for CIM cmdletization that was previously disabled in CoreCLR, addressing a security issue where malicious code could be injected through invalid CDXML files. The XSD schema file is now embedded as a manifest resource and validation is enforced across all platforms. - `ScriptWriter.cs`: Re-enabled XSD validation for all platforms (removed CORECLR conditional compilation), refactored XML reader settings initialization, and embedded XSD schema loaded from manifest resources - `Cdxml.Tests.ps1` and `invalid_verb.cdxml`: Added test case to verify that CDXML files with injection attempts in the Verb attribute are properly blocked by validation - `System.Management.Automation.csproj`: Added `cmdlets-over-objects.xsd` as an embedded resource to enable schema validation <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->