Runner tag defined in scan execution policy is ignored

Summary

A prospect is testing scan execution policies as part of an Ultimate trial. They have defined the following policy:

type: scan_execution_policy
name: SAST Policy project
description: ''
enabled: true
rules:
  - type: pipeline
    branch_type: all
actions:
  - scan: sast
    tags:
      - docker
skip_ci:
  allowed: true
  allowlist:
    users: []

However, the job is picked by a different runner.

Steps to reproduce

  • A GitLab self hosted 17.9 instance
  • An instance runner tagged as docker and another one tagged shell
  • A SAST scan defined at the project level, the job uses runner tag: docker. The scanner is executed by the tagged runner and works fine
  • A scan execution policy defined at the project level that starts a SAST scan and also uses the tag for the docker runner.
  • The job launched by the policy is using the shell runner instead and the job fails

Example Project

What is the current bug behavior?

What is the expected correct behavior?

The job defined with the scan execution policy should be executed by the docker runner and succeed.

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

 (For installations with omnibus-gitlab package run and paste the output of: \`sudo gitlab-rake gitlab:env:info\`)  (For installations from source run and paste the output of: \`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\`)  

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:check SANITIZE=true`)

(For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`)

(we will only investigate if the tests are passing)

Possible fixes