Update `MaxVisitCount` and `MaxHashtableKeyCount` if `VisitorSafeValueContext` indicates `SkipLimitCheck` is true by SeeminglyScience · Pull Request #27306 · PowerShell/PowerShell
… `VisitorSafeValueContext` indicates `SkipLimitCheck` is true Update MaxVisitCount and MaxHashtableKeyCount if visitor safe value context indicates SkipLimitCheck is true Related work items: #163537 ---- #### AI description (iteration 1) #### PR Classification Enhancement: Conditionally update AST limit checks based on safe value context flags. #### PR Summary This pull request refactors the safe value visitor to initialize runtime limit values, setting them to maximum if the `SkipLimitCheck` flag is present, and adjusts the corresponding condition checks to support larger AST structures safely. - `src/System.Management.Automation/engine/parser/SafeValues.cs`: Replaced hard-coded limit constants with runtime-initialized readonly fields based on the safe value context, and updated conditional checks in `IsAstSafe` and `VisitHashtable`. - `test/powershell/Modules/Microsoft.PowerShell.Utility/PowerShellData.tests.ps1`: Added tests to validate behavior when using `-SkipLimitCheck`, ensuring insecure PSD1 files are properly rejected. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #163537
AI review requested due to automatic review settings
JustinGrote pushed a commit to JustinGrote/PowerShell that referenced this pull request
…eContext` indicates `SkipLimitCheck` is true (PowerShell#27306) Co-authored-by: Dongbo Wang <dongbow@microsoft.com>
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