Skip to content

Commit

Permalink
Jfrog Mapper: Display CVE data in control Desc (#81)
Browse files Browse the repository at this point in the history
Signed-off-by: Rony Xavier <rxavier@mitre.org>

Co-authored-by: Rony Xavier <rxavier@mitre.org>
  • Loading branch information
rx294 and Rony Xavier authored Mar 16, 2021
1 parent 2247f9e commit eee98a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/heimdall_tools/jfrog_xray_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ def finding(vulnerability)
[finding]
end

def format_control_desc(vulnerability)
text = []
info = vulnerability['component_versions']['more_details']
text << info['description'].to_s
text << "cves: #{info['cves'].to_s }" unless info['cves'].nil?
text.join("<br>")
end

def nist_tag(cweid)
entries = @cwe_nist_mapping.select { |x| cweid.include?(x[:cweid].to_s) && !x[:nistid].nil? }
tags = entries.map { |x| x[:nistid] }
Expand Down Expand Up @@ -119,7 +127,7 @@ def to_hdf
# If thats a case MD5 hash is used to collapse vulnerability findings of the same type.
item['id'] = vulnerability['id'].empty? ? OpenSSL::Digest::MD5.digest(vulnerability['summary'].to_s).unpack("H*")[0].to_s : vulnerability['id']
item['title'] = vulnerability['summary'].to_s
item['desc'] = vulnerability['component_versions']['more_details']['description'].to_s
item['desc'] = format_control_desc(vulnerability)
item['impact'] = impact(vulnerability['severity'].to_s)
item['code'] = NA_STRING
item['results'] = finding(vulnerability)
Expand Down

0 comments on commit eee98a2

Please sign in to comment.