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
a7e8caeb
Commit
a7e8caeb
authored
Dec 15, 2021
by
Zamir Martins Filho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add vulnerability_states for scan_result_policies
as it was done by Vulnerability-Check. Changelog: changed EE: true
parent
e5a2c3af
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
4 deletions
+24
-4
ee/app/services/security/security_orchestration_policies/process_scan_result_policy_service.rb
...hestration_policies/process_scan_result_policy_service.rb
+2
-1
ee/app/validators/json_schemas/security_orchestration_policy.json
...alidators/json_schemas/security_orchestration_policy.json
+18
-1
ee/spec/factories/security/policies.rb
ee/spec/factories/security/policies.rb
+2
-1
ee/spec/services/security/security_orchestration_policies/process_scan_result_policy_service_spec.rb
...ation_policies/process_scan_result_policy_service_spec.rb
+1
-0
ee/spec/workers/security/create_orchestration_policy_worker_spec.rb
...rkers/security/create_orchestration_policy_worker_spec.rb
+1
-1
No files found.
ee/app/services/security/security_orchestration_policies/process_scan_result_policy_service.rb
View file @
a7e8caeb
...
@@ -45,7 +45,8 @@ module Security
...
@@ -45,7 +45,8 @@ module Security
user_ids:
project
.
users
.
get_ids_by_username
(
action_info
[
:approvers
]),
user_ids:
project
.
users
.
get_ids_by_username
(
action_info
[
:approvers
]),
vulnerabilities_allowed:
rule
[
:vulnerabilities_allowed
],
vulnerabilities_allowed:
rule
[
:vulnerabilities_allowed
],
report_type: :scan_finding
,
report_type: :scan_finding
,
orchestration_policy_idx:
policy_index
orchestration_policy_idx:
policy_index
,
vulnerability_states:
rule
[
:vulnerability_states
]
}
}
end
end
...
...
ee/app/validators/json_schemas/security_orchestration_policy.json
View file @
a7e8caeb
...
@@ -245,7 +245,8 @@
...
@@ -245,7 +245,8 @@
"branches"
,
"branches"
,
"scanners"
,
"scanners"
,
"vulnerabilities_allowed"
,
"vulnerabilities_allowed"
,
"severity_levels"
"severity_levels"
,
"vulnerability_states"
],
],
"properties"
:
{
"properties"
:
{
"type"
:
{
"type"
:
{
...
@@ -289,6 +290,22 @@
...
@@ -289,6 +290,22 @@
"type"
:
"string"
"type"
:
"string"
}
}
}
}
},
"vulnerability_states"
:{
"type"
:
"array"
,
"additionalItems"
:
false
,
"items"
:{
"type"
:
{
"enum"
:
[
"newly_detected"
,
"detected"
,
"confirmed"
,
"resolved"
,
"dismissed"
],
"type"
:
"string"
}
}
}
}
},
},
"additionalProperties"
:
false
"additionalProperties"
:
false
...
...
ee/spec/factories/security/policies.rb
View file @
a7e8caeb
...
@@ -48,7 +48,8 @@ FactoryBot.define do
...
@@ -48,7 +48,8 @@ FactoryBot.define do
branches:
%w[master]
,
branches:
%w[master]
,
scanners:
%w[container_scanning]
,
scanners:
%w[container_scanning]
,
vulnerabilities_allowed:
0
,
vulnerabilities_allowed:
0
,
severity_levels:
%w[critical]
severity_levels:
%w[critical]
,
vulnerability_states:
%w[detected]
}
}
]
]
end
end
...
...
ee/spec/services/security/security_orchestration_policies/process_scan_result_policy_service_spec.rb
View file @
a7e8caeb
...
@@ -61,6 +61,7 @@ RSpec.describe Security::SecurityOrchestrationPolicies::ProcessScanResultPolicyS
...
@@ -61,6 +61,7 @@ RSpec.describe Security::SecurityOrchestrationPolicies::ProcessScanResultPolicyS
expect
(
scan_finding_rule
.
scanners
).
to
eq
(
first_rule
[
:scanners
])
expect
(
scan_finding_rule
.
scanners
).
to
eq
(
first_rule
[
:scanners
])
expect
(
scan_finding_rule
.
severity_levels
).
to
eq
(
first_rule
[
:severity_levels
])
expect
(
scan_finding_rule
.
severity_levels
).
to
eq
(
first_rule
[
:severity_levels
])
expect
(
scan_finding_rule
.
vulnerabilities_allowed
).
to
eq
(
first_rule
[
:vulnerabilities_allowed
])
expect
(
scan_finding_rule
.
vulnerabilities_allowed
).
to
eq
(
first_rule
[
:vulnerabilities_allowed
])
expect
(
scan_finding_rule
.
vulnerability_states
).
to
eq
(
first_rule
[
:vulnerability_states
])
expect
(
scan_finding_rule
.
approvals_required
).
to
eq
(
first_action
[
:approvals_required
])
expect
(
scan_finding_rule
.
approvals_required
).
to
eq
(
first_action
[
:approvals_required
])
end
end
end
end
...
...
ee/spec/workers/security/create_orchestration_policy_worker_spec.rb
View file @
a7e8caeb
...
@@ -46,7 +46,7 @@ RSpec.describe Security::CreateOrchestrationPolicyWorker do
...
@@ -46,7 +46,7 @@ RSpec.describe Security::CreateOrchestrationPolicyWorker do
name:
'CS critical policy'
,
name:
'CS critical policy'
,
description:
'This policy with CS for critical policy'
,
description:
'This policy with CS for critical policy'
,
enabled:
true
,
enabled:
true
,
rules:
[{
type:
'scan_finding'
,
branches:
%w[production]
,
vulnerabilities_allowed:
0
,
severity_levels:
%w[critical]
,
scanners:
%w[container_scanning]
}],
rules:
[{
type:
'scan_finding'
,
branches:
%w[production]
,
vulnerabilities_allowed:
0
,
severity_levels:
%w[critical]
,
scanners:
%w[container_scanning]
,
vulnerability_states:
%w[newly_detected]
}],
actions:
[
actions:
[
{
type:
'require_approval'
,
approvals_required:
1
,
approvers:
%w[admin]
}
{
type:
'require_approval'
,
approvals_required:
1
,
approvers:
%w[admin]
}
]
]
...
...
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