File tree 3 files changed +7
-3
lines changed
3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 3
3
require 'utilities/xml_to_hash'
4
4
5
5
NIST_REFERENCE_NAME = 'Standards Mapping - NIST Special Publication 800-53 Revision 4' . freeze
6
+ DEFAULT_NIST_TAG = [ "SA-11" , "RA-5" ] . freeze
6
7
7
8
module HeimdallTools
8
9
class FortifyMapper
@@ -68,7 +69,7 @@ def nist_tag(rule)
68
69
references = rule [ 'References' ] [ 'Reference' ]
69
70
references = [ references ] unless references . is_a? ( Array )
70
71
tag = references . detect { |x | x [ 'Author' ] . eql? ( NIST_REFERENCE_NAME ) }
71
- tag . nil? ? 'unmapped' : tag [ 'Title' ] . match ( /[a-zA-Z][a-zA-Z]-\d {1,2}/ )
72
+ tag . nil? ? DEFAULT_NIST_TAG : tag [ 'Title' ] . match ( /[a-zA-Z][a-zA-Z]-\d {1,2}/ )
72
73
end
73
74
74
75
def impact ( classid )
Original file line number Diff line number Diff line change 5
5
6
6
RESOURCE_DIR = Pathname . new ( __FILE__ ) . join ( '../../data' )
7
7
8
+ DEFAULT_NIST_TAG = [ "SA-11" , "RA-5" ] . freeze
9
+
8
10
MAPPING_FILES = {
9
11
cwe : File . join ( RESOURCE_DIR , 'cwe-nist-mapping.csv' ) ,
10
12
owasp : File . join ( RESOURCE_DIR , 'owasp-nist-mapping.csv' )
@@ -237,7 +239,7 @@ def get_nist_tags
237
239
return [ @mappings [ tag_type ] [ parsed_tag ] ] . flatten . uniq
238
240
end
239
241
240
- [ 'unmapped' ] # HDF expects this to be a list, but not an empty list even if there aren't results
242
+ DEFAULT_NIST_TAG # Entries with unmapped NIST tags are defaulted to NIST tags ‘SA-11, RA-5 Rev_4’
241
243
end
242
244
243
245
def hdf
Original file line number Diff line number Diff line change 7
7
RESOURCE_DIR = Pathname . new ( __FILE__ ) . join ( '../../data' )
8
8
9
9
CWE_NIST_MAPPING_FILE = File . join ( RESOURCE_DIR , 'cwe-nist-mapping.csv' )
10
+ DEFAULT_NIST_TAG = [ "SA-11" , "RA-5" ] . freeze
10
11
11
12
# rubocop:disable Metrics/AbcSize
12
13
@@ -66,7 +67,7 @@ def format_code_desc(code_desc)
66
67
def nist_tag ( cweid )
67
68
entries = @cwe_nist_mapping . select { |x | x [ :cweid ] . to_s . eql? ( cweid . to_s ) }
68
69
tags = entries . map { |x | [ x [ :nistid ] , "Rev_#{ x [ :rev ] } " ] }
69
- tags . empty? ? [ 'unmapped' ] : tags . flatten . uniq
70
+ tags . empty? ? DEFAULT_NIST_TAG : tags . flatten . uniq
70
71
end
71
72
72
73
def impact ( riskcode )
You can’t perform that action at this time.
0 commit comments