diff options
author | Tetiana Chupryna <tchupryna@gitlab.com> | 2019-08-09 09:30:58 +0000 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2019-08-09 09:30:58 +0000 |
commit | 06b98532ce741199d6452ffadca026caf436e5ed (patch) | |
tree | 22325be36b3755cd2ad52ee0fdd2ca3b378eedfa /ee/lib | |
parent | b58b809934f1fd0def6d4e7a1dd5afb8bf58ff9c (diff) | |
download | gitlab-ce-06b98532ce741199d6452ffadca026caf436e5ed.tar.gz |
Symbolize keys for vulnerability
Use only symbols everywhere to avoid confusion
Diffstat (limited to 'ee/lib')
-rw-r--r-- | ee/lib/gitlab/ci/parsers/security/formatters/dependency_list.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ee/lib/gitlab/ci/parsers/security/formatters/dependency_list.rb b/ee/lib/gitlab/ci/parsers/security/formatters/dependency_list.rb index 3320e71c7dd..774a39b1a8a 100644 --- a/ee/lib/gitlab/ci/parsers/security/formatters/dependency_list.rb +++ b/ee/lib/gitlab/ci/parsers/security/formatters/dependency_list.rb @@ -37,7 +37,7 @@ module Gitlab # https://gitlab.com/gitlab-org/security-products/analyzers/common/blob/a0a5074c49f34332aa3948cd9d6dc2c054cdf3a7/issue/issue.go#L169 def location(dependency, file_path) { - "file" => file_path, + 'file' => file_path, 'dependency' => { 'package' => { 'name' => dependency['package']['name'] @@ -69,9 +69,16 @@ module Gitlab def collect_vulnerabilities(vulnerabilities, dependency, file_path) dependency_location = location(dependency, file_path) - vulnerabilities.select do |vulnerability| - vulnerability['location'] == dependency_location - end + vulnerabilities + .select { |vulnerability| vulnerability['location'] == dependency_location } + .map { |vulnerability| formatted_vulnerability(vulnerability) } + end + + def formatted_vulnerability(vulnerability) + { + name: vulnerability['name'], + severity: vulnerability['severity'].downcase + } end end end |