Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e925cc5c
Commit
e925cc5c
authored
May 06, 2021
by
Alan (Maciej) Paruszewski
Committed by
Kerri Miller
May 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend pipeline configuration only when policy is valid
parent
4e8139cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
ee/lib/gitlab/ci/config/security_orchestration_policies/processor.rb
...ab/ci/config/security_orchestration_policies/processor.rb
+1
-0
ee/spec/lib/gitlab/ci/config/security_orchestration_policies/processor_spec.rb
.../config/security_orchestration_policies/processor_spec.rb
+25
-0
No files found.
ee/lib/gitlab/ci/config/security_orchestration_policies/processor.rb
View file @
e925cc5c
...
@@ -16,6 +16,7 @@ module Gitlab
...
@@ -16,6 +16,7 @@ module Gitlab
def
perform
def
perform
return
@config
unless
project
&
.
feature_available?
(
:security_orchestration_policies
)
return
@config
unless
project
&
.
feature_available?
(
:security_orchestration_policies
)
return
@config
unless
security_orchestration_policy_configuration
&
.
enabled?
return
@config
unless
security_orchestration_policy_configuration
&
.
enabled?
return
@config
unless
security_orchestration_policy_configuration
.
policy_configuration_valid?
return
@config
unless
extend_configuration?
return
@config
unless
extend_configuration?
merged_config
=
@config
.
deep_merge
(
on_demand_scans_template
)
merged_config
=
@config
.
deep_merge
(
on_demand_scans_template
)
...
...
ee/spec/lib/gitlab/ci/config/security_orchestration_policies/processor_spec.rb
View file @
e925cc5c
...
@@ -46,6 +46,29 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do
...
@@ -46,6 +46,29 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do
end
end
end
end
shared_examples
'when policy is invalid'
do
let_it_be
(
:policy_yml
)
do
<<-
EOS
scan_execution_policy:
- name: Run DAST in every pipeline
description: This policy enforces to run DAST for every pipeline within the project
enabled: true
rules:
- type: pipeline
branches: "production"
actions:
- scan: dast
site_profile: Site Profile
scanner_profile: Scanner Profile
EOS
end
it
'does not modify the config'
,
:aggregate_failures
do
expect
(
config
).
not_to
receive
(
:deep_merge
)
expect
(
subject
).
to
eq
(
config
)
end
end
context
'when feature is not licensed'
do
context
'when feature is not licensed'
do
it
'does not modify the config'
do
it
'does not modify the config'
do
expect
(
subject
).
to
eq
(
config
)
expect
(
subject
).
to
eq
(
config
)
...
@@ -91,6 +114,7 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do
...
@@ -91,6 +114,7 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do
end
end
it_behaves_like
'with pipeline source applicable for CI'
it_behaves_like
'with pipeline source applicable for CI'
it_behaves_like
'when policy is invalid'
context
'when DAST profiles are found'
do
context
'when DAST profiles are found'
do
let_it_be
(
:dast_scanner_profile
)
{
create
(
:dast_scanner_profile
,
project:
project
,
name:
'Scanner Profile'
)
}
let_it_be
(
:dast_scanner_profile
)
{
create
(
:dast_scanner_profile
,
project:
project
,
name:
'Scanner Profile'
)
}
...
@@ -133,6 +157,7 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do
...
@@ -133,6 +157,7 @@ RSpec.describe Gitlab::Ci::Config::SecurityOrchestrationPolicies::Processor do
end
end
it_behaves_like
'with pipeline source applicable for CI'
it_behaves_like
'with pipeline source applicable for CI'
it_behaves_like
'when policy is invalid'
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment