Wildcard branch name not working

Summary

The Scan Execution Policy UI does not allow policies with wildcard characters as part of the branch name

Steps to reproduce

  1. Create a scan execution policy at the project level
  2. Add a wildcard to the branch name and attempt to save the policy
  3. Observe that the policy cannot be saved and an error is displayed

Example Project

What is the current bug behavior?

image

What is the expected correct behavior?

  1. Users will be able to save project-level scan execution policies if at least one branch matches a wildcard branch name
  2. Users will be warned but not prevented from creating the policy if the branch name contains a wildcard but does not match any of the project branches

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