Commit c017a014 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix_bug' into 'master'

Add remediation based on cve or id

See merge request gitlab-org/gitlab!73581
parents 84444203 84a557d4
...@@ -38,7 +38,9 @@ module EE ...@@ -38,7 +38,9 @@ module EE
override :create_findings override :create_findings
def create_findings def create_findings
collate_remediations.each { |finding| create_finding(finding, create_remediations(report_data['remediations'])) } collate_remediations.each do |finding|
create_finding(finding, create_remediations(finding["remediations"]))
end
end end
end end
end end
......
...@@ -88,6 +88,13 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do ...@@ -88,6 +88,13 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do
expect(finding.remediations.first.checksum).to eq(expected_remediation.checksum) expect(finding.remediations.first.checksum).to eq(expected_remediation.checksum)
end end
it 'does not assign any remediation to the finding if there exists no related remediation' do
finding = report.findings.find { |x| x.compare_key == 'yarn/yarn.lock:saml2-js:gemnasium:9952e574-7b5b-46fa-a270-aeb694198a98' }
expect(Gitlab::Json.parse(finding.raw_metadata).dig('remediations').first).to be_nil
expect(finding.remediations).to match([])
end
it 'does not find remediation with different id' do it 'does not find remediation with different id' do
fix_with_id = { fix_with_id = {
"fixes": [ "fixes": [
......
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