GitLab Compliance - Hands-On Lab: Scan Execution Policies
Estimated time to complete: 15 minutes
Objectives
Scan execution policies allow you to run security scans against projects and groups in a consistent manner. In this lab, you will learn how to add a scan execution policy to your project.
Task A. Create a scan execution policy
-
In the left sidebar, select Secure > Policies.
-
Select New policy.
-
Under Scan execution policy, select Select policy.
-
In the name, input
run scan. -
Add a relevant description in the description field.
-
Under ‘Configuration Type’, switch from “Template” to “Custom”.
-
In the Actions, set the scan to run a Secret Detection scan. Leave all action configurations at default.
-
In the Conditions section, set to Triggers: for all branches using All pipeline sources with No exceptions.
-
Select Configure new project with the new policy.
-
Select Merge.
Task B. Testing your scan execution policy
-
Navigate back to your
Compliance Projectproject. -
Select + > New file.
-
Enter anything for the Filename and file contents.
-
Select Commit changes.
-
Enter any commit message, or leave it as default.
-
Set the “Branch” option to Commit to a new branch
-
Enter any branch name, or leave it as default, and ensure that the Create a merge request for the change option is selected.
-
Select Commit changes.
-
On the Merge Request creation page that you are directed to, scroll down and select Create merge request.
-
Review the Merge Request pipeline. Note that there is now a secret detection scan job.
Lab Guide Complete
You have completed this lab exercise. You can view the other lab guides for this course.
Suggestions?
If you wish to make a change to the lab, please submit your changes via Merge Request.
c2465970)
