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
b9e6510d
Commit
b9e6510d
authored
Jul 02, 2021
by
Adam Cohen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove sort_dependency_vulnerabilities feature flag
Changelog: other EE: true
parent
9dce5fff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
52 deletions
+15
-52
ee/app/services/security/dependency_list_service.rb
ee/app/services/security/dependency_list_service.rb
+1
-1
ee/config/feature_flags/development/sort_dependency_vulnerabilities.yml
...ure_flags/development/sort_dependency_vulnerabilities.yml
+0
-8
ee/spec/services/security/dependency_list_service_spec.rb
ee/spec/services/security/dependency_list_service_spec.rb
+14
-43
No files found.
ee/app/services/security/dependency_list_service.rb
View file @
b9e6510d
...
...
@@ -55,7 +55,7 @@ module Security
when
'packager'
collection
.
sort_by!
{
|
a
|
a
[
:packager
]
}
when
'severity'
sort_dependency_vulnerabilities_by_severity!
(
collection
)
if
Feature
.
enabled?
(
:sort_dependency_vulnerabilities
,
@pipeline
.
project
,
default_enabled:
true
)
sort_dependency_vulnerabilities_by_severity!
(
collection
)
sort_dependencies_by_severity!
(
collection
)
else
collection
.
sort_by!
{
|
a
|
a
[
:name
]
}
...
...
ee/config/feature_flags/development/sort_dependency_vulnerabilities.yml
deleted
100644 → 0
View file @
9dce5fff
---
name
:
sort_dependency_vulnerabilities
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62983
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/332852
milestone
:
'
14.0'
type
:
development
group
:
group::composition analysis
default_enabled
:
true
ee/spec/services/security/dependency_list_service_spec.rb
View file @
b9e6510d
...
...
@@ -110,54 +110,25 @@ RSpec.describe Security::DependencyListService do
}
end
context
(
'when the sort_dependency_vulnerabilities feature flag is true'
)
do
it
'returns array of data sorted by package severity level in ascending order'
do
dependencies
=
subject
.
last
(
2
).
map
do
|
dependency
|
{
name:
dependency
[
:name
],
vulnerabilities:
dependency
[
:vulnerabilities
].
map
do
|
vulnerability
|
vulnerability
[
:severity
]
end
}
end
expect
(
dependencies
).
to
eq
([{
name:
"nokogiri"
,
vulnerabilities:
[
"high"
]
},
{
name:
"saml2-js"
,
vulnerabilities:
%w(critical medium unknown)
}])
it
'returns array of data sorted by package severity level in ascending order'
do
dependencies
=
subject
.
last
(
2
).
map
do
|
dependency
|
{
name:
dependency
[
:name
],
vulnerabilities:
dependency
[
:vulnerabilities
].
map
do
|
vulnerability
|
vulnerability
[
:severity
]
end
}
end
it
'returns array of data with package vulnerabilities sorted in descending order'
do
saml2js_dependency
=
subject
.
find
{
|
dep
|
dep
[
:name
]
==
'saml2-js'
}
saml2js_severities
=
saml2js_dependency
[
:vulnerabilities
].
map
{
|
v
|
v
[
:severity
]
}
expect
(
saml2js_severities
).
to
eq
(
%w(critical medium unknown)
)
end
expect
(
dependencies
).
to
eq
([{
name:
"nokogiri"
,
vulnerabilities:
[
"high"
]
},
{
name:
"saml2-js"
,
vulnerabilities:
%w(critical medium unknown)
}])
end
context
(
'when the sort_dependency_vulnerabilities feature flag is false'
)
do
# overwrite the existing findings so we can re-create the original test
let_it_be
(
:pipeline
)
{
create
(
:ee_ci_pipeline
,
:with_dependency_list_report
)
}
let_it_be
(
:nokogiri_finding
)
{
create
(
:vulnerabilities_finding
,
:detected
,
:with_dependency_scanning_metadata
,
:with_pipeline
)
}
let_it_be
(
:nokogiri_pipeline
)
{
create
(
:vulnerabilities_finding_pipeline
,
finding:
nokogiri_finding
,
pipeline:
pipeline
)
}
let_it_be
(
:other_finding
)
{
create
(
:vulnerabilities_finding
,
:detected
,
:with_dependency_scanning_metadata
,
package:
'saml2-js'
,
file:
'yarn/yarn.lock'
,
version:
'1.5.0'
,
raw_severity:
'Unknown'
)
}
let_it_be
(
:other_pipeline
)
{
create
(
:vulnerabilities_finding_pipeline
,
finding:
other_finding
,
pipeline:
pipeline
)
}
it
'returns array of data with package vulnerabilities sorted in descending order'
do
saml2js_dependency
=
subject
.
find
{
|
dep
|
dep
[
:name
]
==
'saml2-js'
}
saml2js_severities
=
saml2js_dependency
[
:vulnerabilities
].
map
{
|
v
|
v
[
:severity
]
}
before
do
stub_feature_flags
(
sort_dependency_vulnerabilities:
false
)
end
it
'returns array of data sorted by package severity level in descending order'
do
dependencies
=
subject
.
last
(
2
).
map
do
|
dependency
|
{
name:
dependency
[
:name
],
vulnerabilities:
dependency
[
:vulnerabilities
].
map
do
|
vulnerability
|
vulnerability
[
:severity
]
end
}
end
expect
(
dependencies
).
to
eq
([{
name:
"saml2-js"
,
vulnerabilities:
[
"unknown"
]
},
{
name:
"nokogiri"
,
vulnerabilities:
[
"high"
]
}])
end
expect
(
saml2js_severities
).
to
eq
(
%w(critical medium unknown)
)
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