vrt 0.7.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/data/1.10.1/deprecated-node-mapping.json +200 -0
- data/lib/data/1.10.1/mappings/cvss_v3/cvss_v3.json +1074 -0
- data/lib/data/1.10.1/mappings/cvss_v3/cvss_v3.schema.json +59 -0
- data/lib/data/1.10.1/mappings/cwe/cwe.json +477 -0
- data/lib/data/1.10.1/mappings/cwe/cwe.schema.json +63 -0
- data/lib/data/1.10.1/mappings/remediation_advice/remediation_advice.json +1543 -0
- data/lib/data/1.10.1/mappings/remediation_advice/remediation_advice.schema.json +75 -0
- data/lib/data/1.10.1/third-party-mappings/remediation_training/secure-code-warrior-links.json +348 -0
- data/lib/data/1.10.1/vrt.schema.json +63 -0
- data/lib/data/1.10.1/vulnerability-rating-taxonomy.json +2171 -0
- data/lib/data/1.10/deprecated-node-mapping.json +200 -0
- data/lib/data/1.10/mappings/cvss_v3/cvss_v3.json +1074 -0
- data/lib/data/1.10/mappings/cvss_v3/cvss_v3.schema.json +59 -0
- data/lib/data/1.10/mappings/cwe/cwe.json +477 -0
- data/lib/data/1.10/mappings/cwe/cwe.schema.json +63 -0
- data/lib/data/1.10/mappings/remediation_advice/remediation_advice.json +1543 -0
- data/lib/data/1.10/mappings/remediation_advice/remediation_advice.schema.json +75 -0
- data/lib/data/1.10/third-party-mappings/remediation_training/secure-code-warriors-links.json +348 -0
- data/lib/data/1.10/vrt.schema.json +63 -0
- data/lib/data/1.10/vulnerability-rating-taxonomy.json +2171 -0
- data/lib/data/1.7.1/deprecated-node-mapping.json +149 -0
- data/lib/data/1.7.1/mappings/cvss_v3/cvss_v3.json +928 -0
- data/lib/data/1.7.1/mappings/cvss_v3/cvss_v3.schema.json +59 -0
- data/lib/data/1.7.1/mappings/cwe/cwe.json +441 -0
- data/lib/data/1.7.1/mappings/cwe/cwe.schema.json +63 -0
- data/lib/data/1.7.1/mappings/remediation_advice/remediation_advice.json +1354 -0
- data/lib/data/1.7.1/mappings/remediation_advice/remediation_advice.schema.json +75 -0
- data/lib/data/1.7.1/vrt.schema.json +63 -0
- data/lib/data/1.7.1/vulnerability-rating-taxonomy.json +1937 -0
- data/lib/data/1.7/deprecated-node-mapping.json +149 -0
- data/lib/data/1.7/mappings/cvss_v3/cvss_v3.json +861 -0
- data/lib/data/1.7/mappings/cvss_v3/cvss_v3.schema.json +59 -0
- data/lib/data/1.7/mappings/cwe/cwe.json +441 -0
- data/lib/data/1.7/mappings/cwe/cwe.schema.json +63 -0
- data/lib/data/1.7/mappings/remediation_advice/remediation_advice.json +1230 -0
- data/lib/data/1.7/mappings/remediation_advice/remediation_advice.schema.json +75 -0
- data/lib/data/1.7/vrt.schema.json +63 -0
- data/lib/data/1.7/vulnerability-rating-taxonomy.json +1937 -0
- data/lib/data/1.8/deprecated-node-mapping.json +149 -0
- data/lib/data/1.8/mappings/cvss_v3/cvss_v3.json +935 -0
- data/lib/data/1.8/mappings/cvss_v3/cvss_v3.schema.json +59 -0
- data/lib/data/1.8/mappings/cwe/cwe.json +453 -0
- data/lib/data/1.8/mappings/cwe/cwe.schema.json +63 -0
- data/lib/data/1.8/mappings/remediation_advice/remediation_advice.json +1381 -0
- data/lib/data/1.8/mappings/remediation_advice/remediation_advice.schema.json +75 -0
- data/lib/data/1.8/vrt.schema.json +63 -0
- data/lib/data/1.8/vulnerability-rating-taxonomy.json +1948 -0
- data/lib/data/1.9/deprecated-node-mapping.json +158 -0
- data/lib/data/1.9/mappings/cvss_v3/cvss_v3.json +1002 -0
- data/lib/data/1.9/mappings/cvss_v3/cvss_v3.schema.json +59 -0
- data/lib/data/1.9/mappings/cwe/cwe.json +457 -0
- data/lib/data/1.9/mappings/cwe/cwe.schema.json +63 -0
- data/lib/data/1.9/mappings/remediation_advice/remediation_advice.json +1409 -0
- data/lib/data/1.9/mappings/remediation_advice/remediation_advice.schema.json +75 -0
- data/lib/data/1.9/vrt.schema.json +63 -0
- data/lib/data/1.9/vulnerability-rating-taxonomy.json +2053 -0
- data/lib/generators/vrt/install_generator.rb +1 -1
- data/lib/vrt.rb +2 -0
- data/lib/vrt/cross_version_mapping.rb +3 -2
- data/lib/vrt/errors.rb +5 -0
- data/lib/vrt/map.rb +8 -5
- data/lib/vrt/mapping.rb +12 -1
- data/lib/vrt/version.rb +1 -1
- metadata +92 -32
@@ -3,7 +3,7 @@ require 'rails/generators/base'
|
|
3
3
|
module Vrt
|
4
4
|
module Generators
|
5
5
|
class InstallGenerator < Rails::Generators::Base
|
6
|
-
source_root(File.expand_path(File.dirname(
|
6
|
+
source_root(File.expand_path(File.dirname(__dir__)))
|
7
7
|
def create_initializer_file
|
8
8
|
copy_file '../vrt.rb', 'config/initializers/vrt.rb'
|
9
9
|
end
|
data/lib/vrt.rb
CHANGED
@@ -6,6 +6,7 @@ require 'vrt/map'
|
|
6
6
|
require 'vrt/node'
|
7
7
|
require 'vrt/mapping'
|
8
8
|
require 'vrt/cross_version_mapping'
|
9
|
+
require 'vrt/errors'
|
9
10
|
|
10
11
|
require 'date'
|
11
12
|
require 'json'
|
@@ -48,6 +49,7 @@ module VRT
|
|
48
49
|
def last_updated(version = nil)
|
49
50
|
version ||= current_version
|
50
51
|
return @last_update[version] if @last_update[version]
|
52
|
+
|
51
53
|
metadata = JSON.parse(json_pathname(version).read)['metadata']
|
52
54
|
@last_update[version] = Date.parse(metadata['release_date'])
|
53
55
|
end
|
@@ -5,7 +5,7 @@ module VRT
|
|
5
5
|
def cross_version_category_mapping
|
6
6
|
category_map = {}
|
7
7
|
deprecated_node_json.each do |key, value|
|
8
|
-
latest_version = value.keys.
|
8
|
+
latest_version = value.keys.max_by { |n| Gem::Version.new(n) }
|
9
9
|
id_list = value[latest_version].split('.')
|
10
10
|
cat_id = id_list[0]
|
11
11
|
sub_id = id_list[0..1].join('.')
|
@@ -26,7 +26,7 @@ module VRT
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def latest_version_for_deprecated_node(vrt_id)
|
29
|
-
deprecated_node_json[vrt_id].keys.
|
29
|
+
deprecated_node_json[vrt_id].keys.max_by { |n| Gem::Version.new(n) }
|
30
30
|
end
|
31
31
|
|
32
32
|
def find_deprecated_node(vrt_id, new_version = nil, max_depth = 'variant')
|
@@ -43,6 +43,7 @@ module VRT
|
|
43
43
|
else
|
44
44
|
parent = vrt_id.split('.')[0..-2].join('.')
|
45
45
|
return nil if parent.empty?
|
46
|
+
|
46
47
|
find_valid_parent_node(parent, new_version, max_depth)
|
47
48
|
end
|
48
49
|
end
|
data/lib/vrt/errors.rb
ADDED
data/lib/vrt/map.rb
CHANGED
@@ -41,15 +41,20 @@ module VRT
|
|
41
41
|
private
|
42
42
|
|
43
43
|
def valid_identifier?(vrt_id)
|
44
|
-
#
|
45
|
-
|
44
|
+
# The upstream json schema in the VRT has changed so we need to support both:
|
45
|
+
# Current: At least one string of lowercase letters or _, plus up to 2 more with stops (no digits)
|
46
|
+
# and Old: At least one string of lowercase letters, numbers, or _,
|
47
|
+
# plus up to 2 more with stops and no leading numbers
|
48
|
+
@_valid_identifiers[vrt_id] ||= vrt_id =~ /other|\A[a-z][a-z_\d]*(\.[a-z][a-z_\d]*){0,2}\z/
|
46
49
|
end
|
47
50
|
|
48
51
|
def construct_lineage(string, max_depth)
|
49
52
|
return unless valid_identifier?(string)
|
53
|
+
|
50
54
|
lineage = ''
|
51
55
|
walk_node_tree(string, max_depth: max_depth) do |ids, node, level|
|
52
56
|
return unless node
|
57
|
+
|
53
58
|
lineage += node.name
|
54
59
|
lineage += ' > ' unless level == ids.length
|
55
60
|
end
|
@@ -79,9 +84,7 @@ module VRT
|
|
79
84
|
|
80
85
|
def build_node(memo, vrt, parent = nil)
|
81
86
|
node = Node.new(vrt.merge('version' => @version, 'parent' => parent))
|
82
|
-
if node.children?
|
83
|
-
node.children = vrt['children'].reduce({}) { |m, v| build_node(m, v, node) }
|
84
|
-
end
|
87
|
+
node.children = vrt['children'].reduce({}) { |m, v| build_node(m, v, node) } if node.children?
|
85
88
|
memo[node.id] = node
|
86
89
|
memo
|
87
90
|
end
|
data/lib/vrt/mapping.rb
CHANGED
@@ -39,8 +39,9 @@ module VRT
|
|
39
39
|
def load_mappings
|
40
40
|
@mappings = {}
|
41
41
|
VRT.versions.each do |version|
|
42
|
-
filename =
|
42
|
+
filename = mapping_file_path(version)
|
43
43
|
next unless File.file?(filename)
|
44
|
+
|
44
45
|
mapping = JSON.parse(File.read(filename))
|
45
46
|
mapping['content'] = key_by_id(mapping['content'])
|
46
47
|
@mappings[version] = mapping
|
@@ -48,6 +49,15 @@ module VRT
|
|
48
49
|
# so this will end up as the earliest version with a mapping file
|
49
50
|
@min_version = version
|
50
51
|
end
|
52
|
+
raise VRT::Errors::MappingNotFound if @mappings.empty?
|
53
|
+
end
|
54
|
+
|
55
|
+
def mapping_file_path(version)
|
56
|
+
filename = VRT::DIR.join(version, 'mappings', "#{@scheme}.json")
|
57
|
+
return filename if File.file?(filename)
|
58
|
+
|
59
|
+
# Supports mappings that are nested under their scheme name e.g. `mappings/cvss/cvss.json`
|
60
|
+
VRT::DIR.join(version, 'mappings', @scheme, "#{@scheme}.json")
|
51
61
|
end
|
52
62
|
|
53
63
|
# Converts arrays to hashes keyed by the id attribute (as a symbol) for easier lookup. So
|
@@ -71,6 +81,7 @@ module VRT
|
|
71
81
|
id_list.each do |id|
|
72
82
|
entry = mapping[id]
|
73
83
|
break unless entry # mapping file doesn't go this deep, return previous value
|
84
|
+
|
74
85
|
best_guess = merge_arrays(best_guess, entry[key]) if entry[key]
|
75
86
|
# use the children mapping for the next iteration
|
76
87
|
mapping = entry['children'] || {}
|
data/lib/vrt/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vrt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Barnett Klane
|
8
8
|
- Max Schwenk
|
9
9
|
- Adam David
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-03-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -18,71 +18,71 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '1
|
21
|
+
version: '2.1'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '1
|
28
|
+
version: '2.1'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: pry
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- - "
|
33
|
+
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '0'
|
35
|
+
version: '0.11'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - "
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0'
|
42
|
+
version: '0.11'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
44
|
+
name: rake
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '12.3'
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - "
|
54
|
+
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
56
|
+
version: '12.3'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
58
|
+
name: rspec
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: '3.6'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
70
|
+
version: '3.6'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
72
|
+
name: rubocop
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 0.56.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - '='
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
85
|
-
description:
|
84
|
+
version: 0.56.0
|
85
|
+
description:
|
86
86
|
email:
|
87
87
|
- barnett@bugcrowd.com
|
88
88
|
- max.schwenk@bugcrowd.com
|
@@ -96,6 +96,26 @@ files:
|
|
96
96
|
- lib/data/1.1/deprecated-node-mapping.json
|
97
97
|
- lib/data/1.1/vrt.schema.json
|
98
98
|
- lib/data/1.1/vulnerability-rating-taxonomy.json
|
99
|
+
- lib/data/1.10.1/deprecated-node-mapping.json
|
100
|
+
- lib/data/1.10.1/mappings/cvss_v3/cvss_v3.json
|
101
|
+
- lib/data/1.10.1/mappings/cvss_v3/cvss_v3.schema.json
|
102
|
+
- lib/data/1.10.1/mappings/cwe/cwe.json
|
103
|
+
- lib/data/1.10.1/mappings/cwe/cwe.schema.json
|
104
|
+
- lib/data/1.10.1/mappings/remediation_advice/remediation_advice.json
|
105
|
+
- lib/data/1.10.1/mappings/remediation_advice/remediation_advice.schema.json
|
106
|
+
- lib/data/1.10.1/third-party-mappings/remediation_training/secure-code-warrior-links.json
|
107
|
+
- lib/data/1.10.1/vrt.schema.json
|
108
|
+
- lib/data/1.10.1/vulnerability-rating-taxonomy.json
|
109
|
+
- lib/data/1.10/deprecated-node-mapping.json
|
110
|
+
- lib/data/1.10/mappings/cvss_v3/cvss_v3.json
|
111
|
+
- lib/data/1.10/mappings/cvss_v3/cvss_v3.schema.json
|
112
|
+
- lib/data/1.10/mappings/cwe/cwe.json
|
113
|
+
- lib/data/1.10/mappings/cwe/cwe.schema.json
|
114
|
+
- lib/data/1.10/mappings/remediation_advice/remediation_advice.json
|
115
|
+
- lib/data/1.10/mappings/remediation_advice/remediation_advice.schema.json
|
116
|
+
- lib/data/1.10/third-party-mappings/remediation_training/secure-code-warriors-links.json
|
117
|
+
- lib/data/1.10/vrt.schema.json
|
118
|
+
- lib/data/1.10/vulnerability-rating-taxonomy.json
|
99
119
|
- lib/data/1.2/deprecated-node-mapping.json
|
100
120
|
- lib/data/1.2/vrt.schema.json
|
101
121
|
- lib/data/1.2/vulnerability-rating-taxonomy.json
|
@@ -136,10 +156,47 @@ files:
|
|
136
156
|
- lib/data/1.6/mappings/remediation_advice.schema.json
|
137
157
|
- lib/data/1.6/vrt.schema.json
|
138
158
|
- lib/data/1.6/vulnerability-rating-taxonomy.json
|
159
|
+
- lib/data/1.7.1/deprecated-node-mapping.json
|
160
|
+
- lib/data/1.7.1/mappings/cvss_v3/cvss_v3.json
|
161
|
+
- lib/data/1.7.1/mappings/cvss_v3/cvss_v3.schema.json
|
162
|
+
- lib/data/1.7.1/mappings/cwe/cwe.json
|
163
|
+
- lib/data/1.7.1/mappings/cwe/cwe.schema.json
|
164
|
+
- lib/data/1.7.1/mappings/remediation_advice/remediation_advice.json
|
165
|
+
- lib/data/1.7.1/mappings/remediation_advice/remediation_advice.schema.json
|
166
|
+
- lib/data/1.7.1/vrt.schema.json
|
167
|
+
- lib/data/1.7.1/vulnerability-rating-taxonomy.json
|
168
|
+
- lib/data/1.7/deprecated-node-mapping.json
|
169
|
+
- lib/data/1.7/mappings/cvss_v3/cvss_v3.json
|
170
|
+
- lib/data/1.7/mappings/cvss_v3/cvss_v3.schema.json
|
171
|
+
- lib/data/1.7/mappings/cwe/cwe.json
|
172
|
+
- lib/data/1.7/mappings/cwe/cwe.schema.json
|
173
|
+
- lib/data/1.7/mappings/remediation_advice/remediation_advice.json
|
174
|
+
- lib/data/1.7/mappings/remediation_advice/remediation_advice.schema.json
|
175
|
+
- lib/data/1.7/vrt.schema.json
|
176
|
+
- lib/data/1.7/vulnerability-rating-taxonomy.json
|
177
|
+
- lib/data/1.8/deprecated-node-mapping.json
|
178
|
+
- lib/data/1.8/mappings/cvss_v3/cvss_v3.json
|
179
|
+
- lib/data/1.8/mappings/cvss_v3/cvss_v3.schema.json
|
180
|
+
- lib/data/1.8/mappings/cwe/cwe.json
|
181
|
+
- lib/data/1.8/mappings/cwe/cwe.schema.json
|
182
|
+
- lib/data/1.8/mappings/remediation_advice/remediation_advice.json
|
183
|
+
- lib/data/1.8/mappings/remediation_advice/remediation_advice.schema.json
|
184
|
+
- lib/data/1.8/vrt.schema.json
|
185
|
+
- lib/data/1.8/vulnerability-rating-taxonomy.json
|
186
|
+
- lib/data/1.9/deprecated-node-mapping.json
|
187
|
+
- lib/data/1.9/mappings/cvss_v3/cvss_v3.json
|
188
|
+
- lib/data/1.9/mappings/cvss_v3/cvss_v3.schema.json
|
189
|
+
- lib/data/1.9/mappings/cwe/cwe.json
|
190
|
+
- lib/data/1.9/mappings/cwe/cwe.schema.json
|
191
|
+
- lib/data/1.9/mappings/remediation_advice/remediation_advice.json
|
192
|
+
- lib/data/1.9/mappings/remediation_advice/remediation_advice.schema.json
|
193
|
+
- lib/data/1.9/vrt.schema.json
|
194
|
+
- lib/data/1.9/vulnerability-rating-taxonomy.json
|
139
195
|
- lib/generators/vrt.rb
|
140
196
|
- lib/generators/vrt/install_generator.rb
|
141
197
|
- lib/vrt.rb
|
142
198
|
- lib/vrt/cross_version_mapping.rb
|
199
|
+
- lib/vrt/errors.rb
|
143
200
|
- lib/vrt/map.rb
|
144
201
|
- lib/vrt/mapping.rb
|
145
202
|
- lib/vrt/node.rb
|
@@ -147,8 +204,12 @@ files:
|
|
147
204
|
homepage: https://github.com/bugcrowd/vrt-ruby
|
148
205
|
licenses:
|
149
206
|
- MIT
|
150
|
-
metadata:
|
151
|
-
|
207
|
+
metadata:
|
208
|
+
homepage_uri: https://github.com/bugcrowd/vrt-ruby
|
209
|
+
changelog_uri: https://github.com/bugcrowd/vrt-ruby/blob/master/CHANGELOG.md
|
210
|
+
source_code_uri: https://github.com/bugcrowd/vrt-ruby
|
211
|
+
bug_tracker_uri: https://github.com/bugcrowd/vrt-ruby/issues
|
212
|
+
post_install_message:
|
152
213
|
rdoc_options: []
|
153
214
|
require_paths:
|
154
215
|
- lib
|
@@ -156,16 +217,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
217
|
requirements:
|
157
218
|
- - ">="
|
158
219
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
220
|
+
version: '2.4'
|
160
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
222
|
requirements:
|
162
223
|
- - ">="
|
163
224
|
- !ruby/object:Gem::Version
|
164
225
|
version: '0'
|
165
226
|
requirements: []
|
166
|
-
|
167
|
-
|
168
|
-
signing_key:
|
227
|
+
rubygems_version: 3.1.2
|
228
|
+
signing_key:
|
169
229
|
specification_version: 4
|
170
230
|
summary: Ruby wrapper for Bugcrowd's Vulnerability Rating Taxonomy
|
171
231
|
test_files: []
|