vrt 0.12.6 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/data/1.14/deprecated-node-mapping.json +239 -0
- data/lib/data/1.14/mappings/cvss_v3/cvss_v3.json +1441 -0
- data/lib/data/1.14/mappings/cvss_v3/cvss_v3.schema.json +59 -0
- data/lib/data/1.14/mappings/cwe/cwe.json +818 -0
- data/lib/data/1.14/mappings/cwe/cwe.schema.json +63 -0
- data/lib/data/1.14/mappings/remediation_advice/remediation_advice.json +2080 -0
- data/lib/data/1.14/mappings/remediation_advice/remediation_advice.schema.json +75 -0
- data/lib/data/1.14/third-party-mappings/remediation_training/secure-code-warrior-links.json +438 -0
- data/lib/data/1.14/vrt.schema.json +63 -0
- data/lib/data/1.14/vulnerability-rating-taxonomy.json +2730 -0
- data/lib/data/1.14.1/deprecated-node-mapping.json +239 -0
- data/lib/data/1.14.1/mappings/cvss_v3/cvss_v3.json +1441 -0
- data/lib/data/1.14.1/mappings/cvss_v3/cvss_v3.schema.json +59 -0
- data/lib/data/1.14.1/mappings/cwe/cwe.json +818 -0
- data/lib/data/1.14.1/mappings/cwe/cwe.schema.json +63 -0
- data/lib/data/1.14.1/mappings/remediation_advice/remediation_advice.json +2080 -0
- data/lib/data/1.14.1/mappings/remediation_advice/remediation_advice.schema.json +75 -0
- data/lib/data/1.14.1/third-party-mappings/remediation_training/secure-code-warrior-links.json +438 -0
- data/lib/data/1.14.1/vrt.schema.json +63 -0
- data/lib/data/1.14.1/vulnerability-rating-taxonomy.json +2730 -0
- data/lib/vrt/cross_version_mapping.rb +2 -2
- data/lib/vrt/map.rb +2 -2
- data/lib/vrt/mapping.rb +9 -5
- data/lib/vrt/node.rb +2 -2
- data/lib/vrt/third_party_links.rb +1 -1
- data/lib/vrt/version.rb +1 -1
- data/lib/vrt.rb +1 -1
- metadata +36 -14
|
@@ -32,14 +32,14 @@ module VRT
|
|
|
32
32
|
def find_deprecated_node(vrt_id, new_version = nil, max_depth = 'variant')
|
|
33
33
|
version = latest_version_for_deprecated_node(vrt_id)
|
|
34
34
|
node_id = deprecated_node_json[vrt_id][new_version] || deprecated_node_json[vrt_id][version]
|
|
35
|
-
new_node = VRT::Map.new(new_version).find_node(node_id, max_depth:
|
|
35
|
+
new_node = VRT::Map.new(new_version).find_node(node_id, max_depth:)
|
|
36
36
|
new_node.nil? ? find_deprecated_node(node_id, new_version, max_depth) : new_node
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def find_valid_parent_node(vrt_id, new_version, max_depth)
|
|
40
40
|
new_map = VRT::Map.new(new_version)
|
|
41
41
|
if new_map.valid?(vrt_id)
|
|
42
|
-
new_map.find_node(vrt_id, max_depth:
|
|
42
|
+
new_map.find_node(vrt_id, max_depth:)
|
|
43
43
|
else
|
|
44
44
|
parent = vrt_id.split('.')[0..-2].join('.')
|
|
45
45
|
return nil if parent.empty?
|
data/lib/vrt/map.rb
CHANGED
|
@@ -18,7 +18,7 @@ module VRT
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def find_node(string, max_depth: 'variant')
|
|
21
|
-
@_found_nodes[string + max_depth] ||= walk_node_tree(string, max_depth:
|
|
21
|
+
@_found_nodes[string + max_depth] ||= walk_node_tree(string, max_depth:)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def valid?(vrt_id)
|
|
@@ -52,7 +52,7 @@ module VRT
|
|
|
52
52
|
return unless valid_identifier?(string)
|
|
53
53
|
|
|
54
54
|
lineage = ''
|
|
55
|
-
walk_node_tree(string, max_depth:
|
|
55
|
+
walk_node_tree(string, max_depth:) do |ids, node, level|
|
|
56
56
|
return unless node
|
|
57
57
|
|
|
58
58
|
lineage += node.name
|
data/lib/vrt/mapping.rb
CHANGED
|
@@ -13,6 +13,8 @@ module VRT
|
|
|
13
13
|
# returns the most specific value provided in the mapping file for the given vrt id
|
|
14
14
|
#
|
|
15
15
|
# if no mapping file exists for the given version, the mapping file for the earliest version available will be used
|
|
16
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
|
17
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
|
16
18
|
def get(id_list, version)
|
|
17
19
|
# update the vrt id to the first version we have a mapping file for
|
|
18
20
|
unless @mappings.key?(version)
|
|
@@ -29,15 +31,17 @@ module VRT
|
|
|
29
31
|
# { remediation_advice: { remediation_advice: '...', references: [...] } }
|
|
30
32
|
keys.each_with_object({}) do |key, acc|
|
|
31
33
|
acc[key.to_sym] = get_key(
|
|
32
|
-
id_list
|
|
33
|
-
mapping
|
|
34
|
-
key:
|
|
34
|
+
id_list:,
|
|
35
|
+
mapping:,
|
|
36
|
+
key:
|
|
35
37
|
) || default&.dig(key)
|
|
36
38
|
end
|
|
37
39
|
else
|
|
38
|
-
get_key(id_list
|
|
40
|
+
get_key(id_list:, mapping:, key: @scheme) || default
|
|
39
41
|
end
|
|
40
42
|
end
|
|
43
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
|
44
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
|
41
45
|
|
|
42
46
|
private
|
|
43
47
|
|
|
@@ -74,7 +78,7 @@ module VRT
|
|
|
74
78
|
if mapping.is_a?(Array) && mapping.first.is_a?(Hash) && mapping.first.key?('id')
|
|
75
79
|
mapping.each_with_object({}) { |entry, acc| acc[entry['id'].to_sym] = key_by_id(entry) }
|
|
76
80
|
elsif mapping.is_a?(Hash)
|
|
77
|
-
mapping.
|
|
81
|
+
mapping.transform_values { |value| key_by_id(value) }
|
|
78
82
|
else
|
|
79
83
|
mapping
|
|
80
84
|
end
|
data/lib/vrt/node.rb
CHANGED
|
@@ -24,11 +24,11 @@ module VRT
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def mappings
|
|
27
|
-
|
|
27
|
+
VRT.mappings.transform_values { |map| map.get(id_list, @version) }
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def third_party_links
|
|
31
|
-
|
|
31
|
+
VRT.third_party_links.transform_values { |map| map.get(id_list, @version) }
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def id_list
|
data/lib/vrt/version.rb
CHANGED
data/lib/vrt.rb
CHANGED
|
@@ -81,7 +81,7 @@ module VRT
|
|
|
81
81
|
def find_node(vrt_id:, preferred_version: nil, max_depth: 'variant', version: nil) # rubocop:disable Lint/UnusedMethodArgument
|
|
82
82
|
new_version = preferred_version || current_version
|
|
83
83
|
if get_map(version: new_version).valid?(vrt_id)
|
|
84
|
-
get_map(version: new_version).find_node(vrt_id, max_depth:
|
|
84
|
+
get_map(version: new_version).find_node(vrt_id, max_depth:)
|
|
85
85
|
elsif deprecated_node?(vrt_id)
|
|
86
86
|
find_deprecated_node(vrt_id, preferred_version, max_depth)
|
|
87
87
|
else
|
metadata
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vrt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.13.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Barnett Klane
|
|
8
8
|
- Max Schwenk
|
|
9
9
|
- Adam David
|
|
10
|
+
- Abhinav Nain
|
|
10
11
|
autorequire:
|
|
11
12
|
bindir: bin
|
|
12
13
|
cert_chain: []
|
|
13
|
-
date: 2024-
|
|
14
|
+
date: 2024-07-18 00:00:00.000000000 Z
|
|
14
15
|
dependencies:
|
|
15
16
|
- !ruby/object:Gem::Dependency
|
|
16
17
|
name: bundler
|
|
@@ -18,75 +19,76 @@ dependencies:
|
|
|
18
19
|
requirements:
|
|
19
20
|
- - "~>"
|
|
20
21
|
- !ruby/object:Gem::Version
|
|
21
|
-
version:
|
|
22
|
+
version: 2.5.14
|
|
22
23
|
type: :development
|
|
23
24
|
prerelease: false
|
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
26
|
requirements:
|
|
26
27
|
- - "~>"
|
|
27
28
|
- !ruby/object:Gem::Version
|
|
28
|
-
version:
|
|
29
|
+
version: 2.5.14
|
|
29
30
|
- !ruby/object:Gem::Dependency
|
|
30
31
|
name: pry
|
|
31
32
|
requirement: !ruby/object:Gem::Requirement
|
|
32
33
|
requirements:
|
|
33
34
|
- - "~>"
|
|
34
35
|
- !ruby/object:Gem::Version
|
|
35
|
-
version:
|
|
36
|
+
version: 0.14.2
|
|
36
37
|
type: :development
|
|
37
38
|
prerelease: false
|
|
38
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
39
40
|
requirements:
|
|
40
41
|
- - "~>"
|
|
41
42
|
- !ruby/object:Gem::Version
|
|
42
|
-
version:
|
|
43
|
+
version: 0.14.2
|
|
43
44
|
- !ruby/object:Gem::Dependency
|
|
44
45
|
name: rake
|
|
45
46
|
requirement: !ruby/object:Gem::Requirement
|
|
46
47
|
requirements:
|
|
47
48
|
- - "~>"
|
|
48
49
|
- !ruby/object:Gem::Version
|
|
49
|
-
version:
|
|
50
|
+
version: 13.2.1
|
|
50
51
|
type: :development
|
|
51
52
|
prerelease: false
|
|
52
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
53
54
|
requirements:
|
|
54
55
|
- - "~>"
|
|
55
56
|
- !ruby/object:Gem::Version
|
|
56
|
-
version:
|
|
57
|
+
version: 13.2.1
|
|
57
58
|
- !ruby/object:Gem::Dependency
|
|
58
59
|
name: rspec
|
|
59
60
|
requirement: !ruby/object:Gem::Requirement
|
|
60
61
|
requirements:
|
|
61
62
|
- - "~>"
|
|
62
63
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: '3.
|
|
64
|
+
version: '3.13'
|
|
64
65
|
type: :development
|
|
65
66
|
prerelease: false
|
|
66
67
|
version_requirements: !ruby/object:Gem::Requirement
|
|
67
68
|
requirements:
|
|
68
69
|
- - "~>"
|
|
69
70
|
- !ruby/object:Gem::Version
|
|
70
|
-
version: '3.
|
|
71
|
+
version: '3.13'
|
|
71
72
|
- !ruby/object:Gem::Dependency
|
|
72
73
|
name: rubocop
|
|
73
74
|
requirement: !ruby/object:Gem::Requirement
|
|
74
75
|
requirements:
|
|
75
76
|
- - '='
|
|
76
77
|
- !ruby/object:Gem::Version
|
|
77
|
-
version:
|
|
78
|
+
version: 1.52.1
|
|
78
79
|
type: :development
|
|
79
80
|
prerelease: false
|
|
80
81
|
version_requirements: !ruby/object:Gem::Requirement
|
|
81
82
|
requirements:
|
|
82
83
|
- - '='
|
|
83
84
|
- !ruby/object:Gem::Version
|
|
84
|
-
version:
|
|
85
|
+
version: 1.52.1
|
|
85
86
|
description:
|
|
86
87
|
email:
|
|
87
88
|
- barnett@bugcrowd.com
|
|
88
89
|
- max.schwenk@bugcrowd.com
|
|
89
90
|
- adam.david@bugcrowd.com
|
|
91
|
+
- abhinav.nain@bugcrowd.com
|
|
90
92
|
executables: []
|
|
91
93
|
extensions: []
|
|
92
94
|
extra_rdoc_files: []
|
|
@@ -146,6 +148,26 @@ files:
|
|
|
146
148
|
- lib/data/1.13/third-party-mappings/remediation_training/secure-code-warrior-links.json
|
|
147
149
|
- lib/data/1.13/vrt.schema.json
|
|
148
150
|
- lib/data/1.13/vulnerability-rating-taxonomy.json
|
|
151
|
+
- lib/data/1.14.1/deprecated-node-mapping.json
|
|
152
|
+
- lib/data/1.14.1/mappings/cvss_v3/cvss_v3.json
|
|
153
|
+
- lib/data/1.14.1/mappings/cvss_v3/cvss_v3.schema.json
|
|
154
|
+
- lib/data/1.14.1/mappings/cwe/cwe.json
|
|
155
|
+
- lib/data/1.14.1/mappings/cwe/cwe.schema.json
|
|
156
|
+
- lib/data/1.14.1/mappings/remediation_advice/remediation_advice.json
|
|
157
|
+
- lib/data/1.14.1/mappings/remediation_advice/remediation_advice.schema.json
|
|
158
|
+
- lib/data/1.14.1/third-party-mappings/remediation_training/secure-code-warrior-links.json
|
|
159
|
+
- lib/data/1.14.1/vrt.schema.json
|
|
160
|
+
- lib/data/1.14.1/vulnerability-rating-taxonomy.json
|
|
161
|
+
- lib/data/1.14/deprecated-node-mapping.json
|
|
162
|
+
- lib/data/1.14/mappings/cvss_v3/cvss_v3.json
|
|
163
|
+
- lib/data/1.14/mappings/cvss_v3/cvss_v3.schema.json
|
|
164
|
+
- lib/data/1.14/mappings/cwe/cwe.json
|
|
165
|
+
- lib/data/1.14/mappings/cwe/cwe.schema.json
|
|
166
|
+
- lib/data/1.14/mappings/remediation_advice/remediation_advice.json
|
|
167
|
+
- lib/data/1.14/mappings/remediation_advice/remediation_advice.schema.json
|
|
168
|
+
- lib/data/1.14/third-party-mappings/remediation_training/secure-code-warrior-links.json
|
|
169
|
+
- lib/data/1.14/vrt.schema.json
|
|
170
|
+
- lib/data/1.14/vulnerability-rating-taxonomy.json
|
|
149
171
|
- lib/data/1.2/deprecated-node-mapping.json
|
|
150
172
|
- lib/data/1.2/vrt.schema.json
|
|
151
173
|
- lib/data/1.2/vulnerability-rating-taxonomy.json
|
|
@@ -248,14 +270,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
248
270
|
requirements:
|
|
249
271
|
- - ">="
|
|
250
272
|
- !ruby/object:Gem::Version
|
|
251
|
-
version: '
|
|
273
|
+
version: '3.1'
|
|
252
274
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
275
|
requirements:
|
|
254
276
|
- - ">="
|
|
255
277
|
- !ruby/object:Gem::Version
|
|
256
278
|
version: '0'
|
|
257
279
|
requirements: []
|
|
258
|
-
rubygems_version: 3.5.
|
|
280
|
+
rubygems_version: 3.5.9
|
|
259
281
|
signing_key:
|
|
260
282
|
specification_version: 4
|
|
261
283
|
summary: Ruby wrapper for Bugcrowd's Vulnerability Rating Taxonomy
|