Spike: Implement Experimental Features Mechanism in policy.yml for Security Policies
Proposal
Problem Statement
We currently lack a consistent and efficient mechanism for introducing new experimental features in the Security Policies domain. Our current approaches have several drawbacks:
- Building frontend toggles in Project/Group settings is time-consuming.
- Creating new application/group settings in the database is resource-intensive.
- Using feature flags for long-lived experiments goes against GitLab's best practices.
Proposed Solution
Introduce a new experiments field in the policy.yml file. This field will be an object containing experiment configurations, allowing users to enable and configure experimental features directly in their security policy project repository.
Example structure:
approval_policies: []
scan_execution_policy: []
experiments:
scheduled_pipeline_execution_policies:
enabled: true
configuration:
min_time_window: 10000
limits_based_on_scope:
enabled: true
configuration:
max_applied_policies: 10
other_experiment:
enabled: false
Benefits
- Simplified user experience: Users can easily enable and configure experimental features.
- Reduced development overhead: No need for frontend toggles or database settings for each experiment.
- Adheres to GitLab best practices: Avoids long-lived feature flags.
- Flexible configuration: Allows for experiment-specific configuration options.
- Easy evaluation: Users can test experimental features before GA release without waiting for feature flag enablement.
Implementation Considerations
- Define a standard structure for experiment configurations in policy.yml.
- Implement a parser to read and validate the experiments section.
- Integrate the experimental feature toggle mechanism with the existing security policy enforcement logic.
- Ensure proper documentation for users on how to utilize the new experiments field.
- Develop a process for graduating experimental features to stable features.
Next Steps:
- Refine and approve the proposed solution.
- Break down the implementation into smaller, actionable tasks.
- Prioritize the work within the Security Policies team's roadmap.
- Assign team members to begin implementation.