@@ -31,6 +31,7 @@ class Advisory < Struct.new(:path,
3131 :description ,
3232 :cvss_v2 ,
3333 :cvss_v3 ,
34+ :cvss_v4 ,
3435 :cve ,
3536 :osvdb ,
3637 :ghsa ,
@@ -77,6 +78,7 @@ def self.load(path)
7778 data [ 'description' ] ,
7879 data [ 'cvss_v2' ] ,
7980 data [ 'cvss_v3' ] ,
81+ data [ 'cvss_v4' ] ,
8082 data [ 'cve' ] ,
8183 data [ 'osvdb' ] ,
8284 data [ 'ghsa' ] ,
@@ -136,20 +138,43 @@ def identifiers
136138 # The criticality of the vulnerability based on the CVSS score.
137139 #
138140 def criticality
139- if cvss_v3
140- case cvss_v3
141- when 0.0 then :none
142- when 0.1 ..3.9 then :low
143- when 4.0 ..6.9 then :medium
144- when 7.0 ..8.9 then :high
145- when 9.0 ..10.0 then :critical
146- end
147- elsif cvss_v2
148- case cvss_v2
149- when 0.0 ..3.9 then :low
150- when 4.0 ..6.9 then :medium
151- when 7.0 ..10.0 then :high
152- end
141+ return estimate_criticality ( cvss_v4 ) if cvss_v4
142+ return estimate_criticality ( cvss_v3 ) if cvss_v3
143+
144+ estimate_criticality_cvss_v2 ( cvss_v2 ) if cvss_v2
145+ end
146+
147+ #
148+ # Estimates criticality score based on CVSS v3 or CVSS v4 standard and criticality value.
149+ #
150+ # @param [Float] criticality_value
151+ # The criticality score calculated using given standard.
152+ # @return [:none, :low, :medium, :high, :critical, nil]
153+ # The criticality of the vulnerability based on the CVSS score.
154+ #
155+ def estimate_criticality ( criticality_value )
156+ case criticality_value
157+ when 0.0 then :none
158+ when 0.1 ..3.9 then :low
159+ when 4.0 ..6.9 then :medium
160+ when 7.0 ..8.9 then :high
161+ when 9.0 ..10.0 then :critical
162+ end
163+ end
164+
165+ #
166+ # Estimates criticality score based on CVSS v2 standard and criticality value.
167+ #
168+ # @param [Float] criticality_value
169+ # The criticality score calculated using given standard.
170+ # @return [:none, :low, :medium, :high, :critical, nil]
171+ # The criticality of the vulnerability based on the CVSS score.
172+ #
173+ def estimate_criticality_cvss_v2 ( criticality_value )
174+ case criticality_value
175+ when 0.0 ..3.9 then :low
176+ when 4.0 ..6.9 then :medium
177+ when 7.0 ..10.0 then :high
153178 end
154179 end
155180
0 commit comments