Add default state and validation
What does this MR do and why?
Add default state and validation
Variable configuration now has validation and default state
This change improves the validation of variable override configurations in the security orchestration policy editor. It adds a new function to check if the variable override structure is valid (must have "allowed" as a boolean and "exceptions" as an array). The UI component now displays a validation error message when the structure is invalid, helping users identify and fix configuration problems. Additionally, the component now properly handles empty states and initializes with default values when first opened. The code also includes better type checking and error handling to ensure the variable override feature works correctly.
References
Screenshots or screen recordings
| Description | UI |
|---|---|
| Default state and validation | validation and default.mov |
How to set up and validate locally
-
Enable feature flag:
Feature.enable(:security_policies_optional_variables_control) -
Go to Secure -> Policies
-
New pipeline execution policy
-
Try to open variables option
-
Switch to yaml mode, and type in invalid key or value
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #537933 (closed)