Allow Users to Edit yaml-mode Scan Execution Policies in the Policy UI
<!-- The first section "Release notes" is required if you want to have your release post blog MR auto generated. Currently in BETA, details on the **release post item generator** can be found in the handbook: https://about.gitlab.com/handbook/marketing/blog/release-posts/#release-post-item-generator and this video: https://www.youtube.com/watch?v=rfn9ebgTwKg. The next four sections: "Problem to solve", "Intended users", "User experience goal", and "Proposal", are strongly recommended in your first draft, while the rest of the sections can be filled out during the problem validation or breakdown phase. However, keep in mind that providing complete and relevant information early helps our product team validate the problem and start working on a solution. --> ### Release notes <!-- What is the problem and solution you're proposing? This content sets the overall vision for the feature and serves as the release notes that will populate in various places, including the [release post blog](https://about.gitlab.com/releases/categories/releases/) and [Gitlab project releases](https://gitlab.com/gitlab-org/gitlab/-/releases). " --> ### Problem to solve <!-- What problem do we solve? Try to define the who/what/why of the opportunity as a user story. For example, "As a (who), I want (what), so I can (why/value)." --> As an application security analyst, I want to be able to manage my security policies easily in the UI, without needing to think about creating and associating a separate policy management project. ### Intended users <!-- Who will use this feature? If known, include any of the following: types of users (e.g. Developer), personas, or specific company roles (e.g. Release Manager). It's okay to write "Unknown" and fill this field in later. Personas are described at https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/ * [Cameron (Compliance Manager)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#cameron-compliance-manager) * [Parker (Product Manager)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#parker-product-manager) * [Delaney (Development Team Lead)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#delaney-development-team-lead) * [Presley (Product Designer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#presley-product-designer) * [Devon (DevOps Engineer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#devon-devops-engineer) * [Sidney (Systems Administrator)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#sidney-systems-administrator) * [Sam (Security Analyst)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#sam-security-analyst) * [Rachel (Release Manager)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#rachel-release-manager) * [Alex (Security Operations Engineer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#alex-security-operations-engineer) * [Simone (Software Engineer in Test)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#simone-software-engineer-in-test) * [Allison (Application Ops)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#allison-application-ops) * [Priyanka (Platform Engineer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#priyanka-platform-engineer) * [Dana (Data Analyst)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#dana-data-analyst) --> * [Alex (Security Operations Engineer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#alex-security-operations-engineer) * [Cameron (Compliance Manager)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#cameron-compliance-manager) * [Devon (DevOps Engineer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#devon-devops-engineer) * [Sasha (Software Developer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#sasha-software-developer) * [Sidney (Systems Administrator)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#sidney-systems-administrator) In smaller organizations: * [Delaney (Development Team Lead)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#delaney-development-team-lead) * [Sasha (Software Developer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#sasha-software-developer) ### User experience goal <!-- What is the single user experience workflow this problem addresses? For example, "The user should be able to use the UI/API/.gitlab-ci.yml with GitLab to <perform a specific task>" https://about.gitlab.com/handbook/engineering/ux/ux-research-training/user-story-mapping/ --> ### Proposal <!-- How are we going to solve the problem? Try to include the user journey! https://about.gitlab.com/handbook/journeys/#user-journey --> Note: This is a minimal MVC and is intended to allow us to be iterative and release quickly. Please reference the [Security Orchestration direction page](https://about.gitlab.com/direction/protect/security_orchestration/) for plans to improve this capability in the future. 1. When users first create a new Scan Execution type policy, a new Security Policy Project will be automatically created and associated with the project if one does not already exist. 1. The new project will be pre-configured with all Production Project maintainers and developers added to the new Security Policy Project with Developer permissions 1. The new project will be pre-configured with the default branch protected and only maintainers are allowed to merge to default branch and no-one are allowed to push to default branch. This should override the group level branch protection. 1. The new project will be pre-configured with the individual who is creating the first policy set to be the `Owner` of the new Security Policy Project. This will happen even if they would not have otherwise had permissions to create a Project in the group. 1. The Project will be located in the same Group as the production project. 1. The new project will be pre-configured with the master/default branch set to be a protected branch where only project maintainers/owners have permission to merge into that branch. 1. As we do not yet have an organization-wide way to define a list of security policy approvers, GitLab admins will need to manually add Maintainers to the project to approve these policies 1. New, consolidated UI for editing security policies 1. Users will see that the page previously located at **Security & Compliance -> Threat Monitoring -> Policies** is now located at **Security & Compliance -> Policies** 1. Users will see that the list of policies includes a new column called **Type** with values of either `Container` or `Scan Execution` depending on the type of policy. 1. Users will be able to view Scan Execution policies and will be able to propose changes to Scan Execution policies (create, edit, delete). For this iteration, only `yaml mode` will be available for Scan Execution type policies. 1. Creating, editing, or deleting a policy in the UI will result in the automatic creation of an MR for the Security Policy Project. ### Design - 🎨 [Figma file](https://www.figma.com/file/rHSC5J4RmwYivZLwakENCX/Policies-MVC?node-id=446%3A392) - 🎟 [Design issue](https://gitlab.com/gitlab-org/gitlab/-/issues/322473#note_551807364) (please look at the design management section for more specific details) | No results empty state | No policies empty state | Policies list | | ------ | ------ | ------ | | ![filters-no-results](/uploads/e7a9c4a13a9ec46b5e231ce8e4f3c028/filters-no-results.png)| ![filters-no-policies](/uploads/32837318278fdda269b7366b8ea12705/filters-no-policies.png) | ![policies-states](/uploads/7e0dd6a4bfff1a85672bcf58ecb86d0c/policies-states.png) | | Select new project | Drawer details | Policy creation | | ------ | ------ | ------ | | ![select-new-project-modal](/uploads/47a8fe16e90363af0431690d9d416b06/select-new-project-modal.png) | ![drawer-details](/uploads/35b036dbfc9d6fffb925ca910a370bfd/drawer-details.png) | ![scan-execution-policy](/uploads/4772966ee0df0cdeb174c53afed03d98/scan-execution-policy.png) | ### Further details **Engineering DRI** - ~backend @mparuszewski - ~frontend @lkerr <!-- Include use cases, benefits, goals, or any other details that will help us understand the problem better. --> ### Permissions and Security <!-- What permissions are required to perform the described actions? Are they consistent with the existing permissions as documented for users, groups, and projects as appropriate? Is the proposed behavior consistent between the UI, API, and other access methods (e.g. email replies)? Consider adding checkboxes and expectations of users with certain levels of membership https://docs.gitlab.com/ee/user/permissions.html * [ ] Add expected impact to members with no access (0) * [ ] Add expected impact to Guest (10) members * [ ] Add expected impact to Reporter (20) members * [ ] Add expected impact to Developer (30) members * [ ] Add expected impact to Maintainer (40) members * [ ] Add expected impact to Owner (50) members --> Users who have Developer or higher permissions on the associated Security Policy Project will be able to view policies in the UI and will be able to propose policy changes (create, edit, delete) ### Documentation <!-- See the Feature Change Documentation Workflow https://docs.gitlab.com/ee/development/documentation/workflow.html#for-a-product-change * Add all known Documentation Requirements in this section. See https://docs.gitlab.com/ee/development/documentation/feature-change-workflow.html#documentation-requirements * If this feature requires changing permissions, update the permissions document. See https://docs.gitlab.com/ee/user/permissions.html --> - Documentation will be updated to describe how to create/edit/delete/view policies ### Availability & Testing <!-- This section needs to be retained and filled in during the workflow planning breakdown phase of this feature proposal, if not earlier. What risks does this change pose to our availability? How might it affect the quality of the product? What additional test coverage or changes to tests will be needed? Will it require cross-browser testing? Please list the test areas (unit, integration and end-to-end) that needs to be added or updated to ensure that this feature will work as intended. Please use the list below as guidance. * Unit test changes * Integration test changes * End-to-end test change See the test engineering planning process and reach out to your counterpart Software Engineer in Test for assistance: https://about.gitlab.com/handbook/engineering/quality/test-engineering/#test-planning --> ### What does success look like, and how can we measure that? <!-- Define both the success metrics and acceptance criteria. Note that success metrics indicate the desired business outcomes, while acceptance criteria indicate when the solution is working correctly. If there is no way to measure success, link to an issue that will implement a way to measure this. Create tracking issue using the the Snowplow event tracking template. See https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/issue_templates/Snowplow%20event%20tracking.md --> ### What is the type of buyer? <!-- What is the buyer persona for this feature? See https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/buyer-persona/ In which enterprise tier should this feature go? See https://about.gitlab.com/handbook/product/pricing/#four-tiers --> ### Is this a cross-stage feature? <!-- Communicate if this change will affect multiple Stage Groups or product areas. We recommend always start with the assumption that a feature request will have an impact into another Group. Loop in the most relevant PM and Product Designer from that Group to provide strategic support to help align the Group's broader plan and vision, as well as to avoid UX and technical debt. https://about.gitlab.com/handbook/product/#cross-stage-features --> ### Links / references <!-- Label reminders - you should have one of each of the following labels if you can figure out the correct ones -->
epic