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
98963d3a
Commit
98963d3a
authored
Feb 16, 2022
by
Zamir Martins Filho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add validation for approvers with empty array
in respect to scan result policies. EE: true
parent
86a5d20f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
ee/app/validators/json_schemas/security_orchestration_policy.json
...alidators/json_schemas/security_orchestration_policy.json
+4
-0
ee/spec/models/security/orchestration_policy_configuration_spec.rb
...odels/security/orchestration_policy_configuration_spec.rb
+30
-1
No files found.
ee/app/validators/json_schemas/security_orchestration_policy.json
View file @
98963d3a
...
...
@@ -335,6 +335,7 @@
},
"user_approvers"
:
{
"type"
:
"array"
,
"minItems"
:
1
,
"additionalItems"
:
false
,
"items"
:
{
"minLength"
:
1
,
...
...
@@ -343,6 +344,7 @@
},
"user_approvers_ids"
:
{
"type"
:
"array"
,
"minItems"
:
1
,
"additionalItems"
:
false
,
"items"
:
{
"minLength"
:
1
,
...
...
@@ -351,6 +353,7 @@
},
"group_approvers"
:
{
"type"
:
"array"
,
"minItems"
:
1
,
"additionalItems"
:
false
,
"items"
:
{
"minLength"
:
1
,
...
...
@@ -359,6 +362,7 @@
},
"group_approvers_ids"
:
{
"type"
:
"array"
,
"minItems"
:
1
,
"additionalItems"
:
false
,
"items"
:
{
"minLength"
:
1
,
...
...
ee/spec/models/security/orchestration_policy_configuration_spec.rb
View file @
98963d3a
...
...
@@ -178,6 +178,35 @@ RSpec.describe Security::OrchestrationPolicyConfiguration do
end
end
end
context
'with scan result policies'
do
let
(
:scan_result_policy
)
{
build
(
:scan_result_policy
,
name:
'Containe security critical severities'
)
}
let
(
:policy_yaml
)
{
build
(
:orchestration_policy_yaml
,
scan_result_policy:
[
scan_result_policy
])
}
it
{
is_expected
.
to
eq
(
true
)
}
context
'with various approvers'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:user_approvers
,
:user_approvers_ids
,
:group_approvers
,
:group_approvers_ids
,
:is_valid
)
do
[]
|
nil
|
nil
|
nil
|
false
[
'username'
]
|
nil
|
nil
|
nil
|
true
nil
|
[]
|
nil
|
nil
|
false
nil
|
[
1
]
|
nil
|
nil
|
true
nil
|
nil
|
[]
|
nil
|
false
nil
|
nil
|
[
'group_path'
]
|
nil
|
true
nil
|
nil
|
nil
|
[]
|
false
nil
|
nil
|
nil
|
[
2
]
|
true
end
with_them
do
let
(
:action
)
{
{
type:
'require_approval'
,
approvals_required:
1
,
user_approvers:
user_approvers
,
user_approvers_ids:
user_approvers_ids
,
group_approvers:
group_approvers
,
group_approvers_ids:
group_approvers_ids
}.
compact
}
let
(
:scan_result_policy
)
{
build
(
:scan_result_policy
,
name:
'Containe security critical severities'
,
actions:
[
action
])
}
it
{
is_expected
.
to
eq
(
is_valid
)
}
end
end
end
end
describe
'#policy_configuration_validation_errors'
do
...
...
@@ -389,7 +418,7 @@ RSpec.describe Security::OrchestrationPolicyConfiguration do
end
end
describe
'#active_
result_execution
_policies'
do
describe
'#active_
scan_result
_policies'
do
let
(
:scan_result_yaml
)
{
build
(
:orchestration_policy_yaml
,
scan_result_policy:
[
build
(
:scan_result_policy
)])
}
let
(
:policy_yaml
)
{
fixture_file
(
'security_orchestration.yml'
,
dir:
'ee'
)
}
...
...
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