Skip to content
代码片段 群组 项目
未验证 提交 07ce5d10 编辑于 作者: Andy Soiron's avatar Andy Soiron 提交者: GitLab
浏览文件

Fix scan execution policy without ci file

This fixes the bug that scan jobs defined in a scan execution
pipeline are not triggered if the target project does not have a
.gitlab-ci.yml file.

Changelog: fixed
EE: true
上级 ebe82f7f
No related branches found
No related tags found
无相关合并请求
...@@ -26,6 +26,8 @@ def perform ...@@ -26,6 +26,8 @@ def perform
return @config if valid_security_orchestration_policy_configurations.blank? return @config if valid_security_orchestration_policy_configurations.blank?
return @config unless extend_configuration? return @config unless extend_configuration?
@config[:workflow] = { rules: [{ when: 'always' }] } if @config.empty?
merged_config = @config.deep_merge(merged_security_policy_config) merged_config = @config.deep_merge(merged_security_policy_config)
if custom_scan_actions_enabled? && active_scan_custom_actions.any? if custom_scan_actions_enabled? && active_scan_custom_actions.any?
......
...@@ -186,6 +186,14 @@ ...@@ -186,6 +186,14 @@
context 'when policy is applicable on branch from the pipeline' do context 'when policy is applicable on branch from the pipeline' do
let(:ref) { 'refs/heads/master' } let(:ref) { 'refs/heads/master' }
context 'and the project does not have a CI configuration' do
let_it_be(:config) { {} }
it 'adds a workflow rule' do
expect(subject).to include({ workflow: { rules: [when: 'always'] } })
end
end
context 'when DAST profiles are not found' do context 'when DAST profiles are not found' do
it 'does not modify the config' do it 'does not modify the config' do
expect(subject[:'dast-on-demand-0']).to eq({ allow_failure: true, script: 'echo "Error during On-Demand Scan execution: Dast site profile was not provided" && false' }) expect(subject[:'dast-on-demand-0']).to eq({ allow_failure: true, script: 'echo "Error during On-Demand Scan execution: Dast site profile was not provided" && false' })
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册