Scheduled scan execution policy does not work
Summary
The pipelines created by scheduled scan execution policies stopped working after Add security_policy_bot user for scan execution... (!103544 - merged)
The job fails with error:
ERROR: Job failed: failed to pull image "registry.gitlab.com/security-products/container-scanning:5" with specified policies [always]: Error response from daemon: Get https://registry.gitlab.com/v2/security-products/container-scanning/manifests/5: unauthorized: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.com/help/user/profile/account/two_factor_authentication#troubleshooting (manager.go:237:0s)
Steps to reproduce
- Create a scheduled scan execution policy
- name: Scheduled policy
description: ''
enabled: true
rules:
- type: schedule
branches:
- main
cadence: 0 0 * * *
actions:
- scan: container_scanning
- scan: secret_detection
- scan: dependency_scanning
- Notice the pipeline created by the scheduled policy fails because
GitLab Security Policy Bot
does not have permissions to pull the container image
Example Project
What is the current bug behavior?
- Security scan jobs fail with error
What is the expected correct behavior?
- Security scan jobs should not be failed
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
Edited by Sashi Kumar Kumaresan