Skip to content

Add support for setting CI variables in Security Policies

What does this MR do and why?

To add ability to specify environment variables for jobs enforced with policies we are adding changes in this MR.

How to set up and validate locally

  1. Create a new project (ie. import https://github.com/digininja/DVWA), add simple gitlab-ci.yml file to run only shell script: echo "Test".
  2. Create a Policy for that project (go to Security & Compliance -> Policies -> Add new -> select Policy Execution type)
  3. Add new policy with variables added:
name: SAST scan
description: description
enabled: true
rules:
- type: pipeline
  branches:
  - main
actions:
- scan: sast
  variables:
    SAST_EXCLUDED_ANALYZERS: semgrep
  1. Run pipeline for your project. You should see that semgrep-sast job was not added to you pipeline.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #346963 (closed)

Edited by Alan (Maciej) Paruszewski

Merge request reports