Dongbo Wang
348e3470c0
Merged PR 38918: Update MaxVisitCount and MaxHashtableKeyCount if 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
2026-03-11 18:24:34 +00:00
..
2023-07-17 15:54:17 -07:00
2020-05-07 17:00:30 +05:00
2023-04-12 21:41:43 -07:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2024-07-26 22:12:44 +05:00
2020-05-07 17:00:30 +05:00
2020-05-07 17:00:30 +05:00
2020-05-23 13:24:53 +00:00
2025-09-23 10:29:11 -07:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2023-02-08 17:48:04 +05:00
2020-05-07 17:00:30 +05:00
2024-09-19 17:24:20 +00:00
2024-02-27 14:52:58 -08:00
2025-08-19 11:51:38 +05:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2020-07-21 11:48:54 -07:00
2020-07-21 11:48:54 -07:00
2023-01-31 12:06:29 -08:00
2020-05-07 17:00:30 +05:00
2022-08-29 11:06:46 -07:00
2023-02-08 17:48:04 +05:00
2020-05-07 17:00:30 +05:00
2022-05-04 10:51:45 -07:00
2021-07-20 09:02:52 +05:00
2023-03-13 15:05:28 -07:00
2022-10-17 15:27:24 -07:00
2024-02-26 11:44:30 -08:00
2020-05-07 17:00:30 +05:00
2025-12-04 10:37:54 -08:00
2022-10-12 16:08:20 -07:00
2020-03-24 11:08:37 -07:00
2022-03-23 09:24:10 -07:00
2024-08-26 19:25:16 -04:00
2020-05-07 17:00:30 +05:00
2020-03-24 11:08:37 -07:00
2020-06-23 14:07:52 -07:00
2021-08-09 14:01:57 -07:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2020-06-23 14:07:52 -07:00
2023-05-02 10:54:39 -07:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2023-07-24 09:34:42 -07:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2020-05-07 17:00:30 +05:00
2023-11-30 10:13:06 +05:00
2025-02-10 11:43:10 +05:00
2020-05-07 17:00:30 +05:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2020-05-07 17:00:30 +05:00
2023-01-31 12:06:29 -08:00
2020-05-07 17:00:30 +05:00
2024-09-19 17:24:20 +00:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2022-01-13 09:33:43 -08:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2023-08-28 09:33:55 -07:00
2020-05-07 17:00:30 +05:00
2020-03-24 11:08:37 -07:00
2022-07-12 11:09:19 +05:00
2020-05-07 17:00:30 +05:00
2020-05-07 17:00:30 +05:00
2021-07-20 09:02:52 +05:00
2020-05-07 17:00:30 +05:00
2026-03-11 18:24:34 +00:00
2020-07-30 22:16:37 -07:00
2020-05-07 17:00:30 +05:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2020-07-21 11:48:54 -07:00
2020-03-24 11:08:37 -07:00
2020-03-24 11:08:37 -07:00
2021-08-09 14:01:57 -07:00
2020-05-07 17:00:30 +05:00
2023-07-24 09:34:42 -07:00
2021-08-16 14:17:07 -07:00
2020-03-24 11:08:37 -07:00
2023-07-27 15:04:30 -07:00
2020-05-07 17:00:30 +05:00
2023-01-31 12:06:29 -08:00
2021-08-30 13:56:52 -07:00
2025-11-20 14:57:21 -08:00
2022-04-26 16:58:37 -07:00
2022-01-13 17:39:54 -08:00
2020-05-07 17:00:30 +05:00
2021-11-01 23:06:05 -07:00
2024-06-24 13:03:22 +05:00
2020-03-24 11:08:37 -07:00
2025-07-14 15:42:14 -07:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2020-03-24 11:08:37 -07:00
2020-05-07 17:00:30 +05:00
2020-05-07 17:00:30 +05:00
2022-06-06 09:55:33 -07:00
2025-06-11 09:50:26 +05:00
2025-09-23 09:19:39 +05:00
2023-01-31 12:06:29 -08:00
2024-12-13 10:24:02 -08:00
2020-03-24 11:08:37 -07:00
2023-06-19 16:20:08 -07:00
2020-03-24 11:08:37 -07:00
2023-01-31 12:06:29 -08:00
2024-07-26 22:12:44 +05:00