Commit 9ae14126 authored by Michael Kozono's avatar Michael Kozono

Merge branch '210327-parse-scanner-from-security-report-scan-scanner' into 'master'

Parse scanner from security report scan.scanner

See merge request gitlab-org/gitlab!36865
parents 38b5dc29 30d09b56
...@@ -12,6 +12,7 @@ module Gitlab ...@@ -12,6 +12,7 @@ module Gitlab
raise SecurityReportParserError, "Invalid report format" unless report_data.is_a?(Hash) raise SecurityReportParserError, "Invalid report format" unless report_data.is_a?(Hash)
report.scanned_resources = report_data.dig('scan', 'scanned_resources') || [] report.scanned_resources = report_data.dig('scan', 'scanned_resources') || []
create_scanner(report, report_data.dig('scan', 'scanner'))
collate_remediations(report_data).each do |vulnerability| collate_remediations(report_data).each do |vulnerability|
create_vulnerability(report, vulnerability, report_data["version"]) create_vulnerability(report, vulnerability, report_data["version"])
......
...@@ -36,7 +36,7 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do ...@@ -36,7 +36,7 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do
"cve": "CVE-1020", "cve": "CVE-1020",
"severity": "High", "severity": "High",
"solution": "Upgrade to latest version.", "solution": "Upgrade to latest version.",
"scanner": { "id": "gemnasium", "name": "Gemnasium", "vendor": { "name": "GitLab" } }, "scanner": { "id": "gemnasium", "name": "Gemnasium" },
"location": {}, "location": {},
"identifiers": [], "identifiers": [],
"links": [{ "url": "" }] "links": [{ "url": "" }]
...@@ -52,8 +52,7 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do ...@@ -52,8 +52,7 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do
"solution": "Upgrade to latest versions.", "solution": "Upgrade to latest versions.",
"scanner": { "scanner": {
"id": "gemnasium", "id": "gemnasium",
"name": "Gemnasium", "name": "Gemnasium"
"vendor": { "name": "GitLab" }
}, },
"location": {}, "location": {},
"identifiers": [], "identifiers": [],
...@@ -69,8 +68,7 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do ...@@ -69,8 +68,7 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do
"solution": "Upgrade to fixed version.\r\n", "solution": "Upgrade to fixed version.\r\n",
"scanner": { "scanner": {
"id": "gemnasium", "id": "gemnasium",
"name": "Gemnasium", "name": "Gemnasium"
"vendor": { "name": "GitLab" }
}, },
"location": {}, "location": {},
"identifiers": [], "identifiers": [],
...@@ -78,7 +76,14 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do ...@@ -78,7 +76,14 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do
} }
], ],
"remediations": [], "remediations": [],
"dependency_files": [] "dependency_files": [],
"scan": {
"scanner": {
"id": "gemnasium",
"name": "Gemnasium",
"vendor": { "name": "GitLab" }
}
}
} }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment