Skip to content

Commit

Permalink
Resolve CWE mapping error (#78)
Browse files Browse the repository at this point in the history
Signed-off-by: Rony Xavier <[email protected]>
  • Loading branch information
rx294 authored Mar 11, 2021
1 parent 233d2ee commit 2247f9e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/heimdall_tools/burpsuite_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def format_code_desc(issue)
end

def nist_tag(cweid)
entries = @cwe_nist_mapping.select { |x| cweid.include? x[:cweid].to_s }
entries = @cwe_nist_mapping.select { |x| cweid.include?(x[:cweid].to_s) && !x[:nistid].nil? }
tags = entries.map { |x| [x[:nistid], "Rev_#{x[:rev]}"] }
tags.empty? ? DEFAULT_NIST_TAG : tags.flatten.uniq
end
Expand Down
2 changes: 1 addition & 1 deletion lib/heimdall_tools/jfrog_xray_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def finding(vulnerability)
end

def nist_tag(cweid)
entries = @cwe_nist_mapping.select { |x| cweid.include? x[:cweid].to_s }
entries = @cwe_nist_mapping.select { |x| cweid.include?(x[:cweid].to_s) && !x[:nistid].nil? }
tags = entries.map { |x| x[:nistid] }
tags.empty? ? DEFAULT_NIST_TAG : tags.flatten.uniq
end
Expand Down
2 changes: 1 addition & 1 deletion lib/heimdall_tools/nessus_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def cci_nist_tag(cci_refs)
end

def plugin_nist_tag(pluginfamily, pluginid)
entries = @cwe_nist_mapping.select { |x| (x[:pluginfamily].eql?(pluginfamily) && (x[:pluginid].eql?('*') || x[:pluginid].eql?(pluginid.to_i)) ) }
entries = @cwe_nist_mapping.select { |x| (x[:pluginfamily].eql?(pluginfamily) && (x[:pluginid].eql?('*') || x[:pluginid].eql?(pluginid.to_i)) ) && !x[:nistid].nil? }
tags = entries.map { |x| [x[:nistid].split('|'), "Rev_#{x[:rev]}"] }
tags.empty? ? DEFAULT_NIST_TAG : tags.flatten.uniq
end
Expand Down
2 changes: 1 addition & 1 deletion lib/heimdall_tools/nikto_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def finding(vulnerability)
end

def nist_tag(niktoid)
entries = @nikto_nist_mapping.select { |x| niktoid.eql?(x[:niktoid].to_s) }
entries = @nikto_nist_mapping.select { |x| niktoid.eql?(x[:niktoid].to_s) && !x[:nistid].nil? }
tags = entries.map { |x| x[:nistid] }
tags.empty? ? DEFAULT_NIST_TAG : tags.flatten.uniq
end
Expand Down
2 changes: 1 addition & 1 deletion lib/heimdall_tools/snyk_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def finding(vulnerability)
end

def nist_tag(cweid)
entries = @cwe_nist_mapping.select { |x| cweid.include? x[:cweid].to_s }
entries = @cwe_nist_mapping.select { |x| cweid.include?(x[:cweid].to_s) && !x[:nistid].nil? }
tags = entries.map { |x| x[:nistid] }
tags.empty? ? DEFAULT_NIST_TAG : tags.flatten.uniq
end
Expand Down
2 changes: 1 addition & 1 deletion lib/heimdall_tools/zap_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def format_code_desc(code_desc)
end

def nist_tag(cweid)
entries = @cwe_nist_mapping.select { |x| x[:cweid].to_s.eql?(cweid.to_s) }
entries = @cwe_nist_mapping.select { |x| x[:cweid].to_s.eql?(cweid.to_s) && !x[:nistid].nil? }
tags = entries.map { |x| [x[:nistid], "Rev_#{x[:rev]}"] }
tags.empty? ? DEFAULT_NIST_TAG : tags.flatten.uniq
end
Expand Down

0 comments on commit 2247f9e

Please sign in to comment.