Skip to content

Commit

Permalink
Merge pull request #44 from mitre/fortifyFixes
Browse files Browse the repository at this point in the history
Make sure the fields we are looking for in Fortify exist before we parse the element
  • Loading branch information
rx294 authored Apr 16, 2020
2 parents d0b9899 + 758f110 commit c646a34
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/heimdall_tools/fortify_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ def primaries(classid)
traces.each do |trace|
entries = trace['Primary']['Entry']
entries = [entries] unless entries.is_a?(Array)
entries = entries.reject { |x| x['Node'].nil? }
# This is just regular array access, it is just written in a manner that allows us
# to use Ruby's safe navigation operator. We rely on
# entry['Node']['SourceLocation']['snippet'] to exist on all of our entries, so if any
# of those are empty we reject that element.
entries = entries.reject { |x| x&.[]('Node')&.[]('SourceLocation')&.[]('snippet').nil? }
entries.each do |entry|
findings << process_entry(entry)
end
Expand Down

0 comments on commit c646a34

Please sign in to comment.