Class: NVD::JSONFeeds::Schema::CVSSv2

Inherits:
Object
  • Object
show all
Defined in:
lib/nvd/json_feeds/schema/cvss_v2.rb

Overview

Represents the "cvssV2" value.

Constant Summary collapse

VERSIONS =
{
  '2.0' => :"2.0"
}
ACCESS_VECTORS =
{
  'NETWORK' => :NETWORK,
  'ADJACENT_NETWORK' => :ADJACENT_NETWORK,
  'LOCAL' => :LOCAL
}
ACCESS_COMPLEXITIES =
{
  'HIGH' => :HIGH,
  'MEDIUM' => :MEDIUM,
  'LOW' => :LOW
}
AUTHENTICATIONS =
{
  'MULTIPLE' => :MULTIPLE,
  'SINGLE'   => :SINGLE,
  'NONE'     => :NONE
}
CIAS =
{
  'NONE' => :NONE,
  'PARTIAL' => :PARTIAL,
  'COMPLETE' => :COMPLETE
}
EXPLOITABILITIES =
{
  'UNPROVEN' => :UNPROVEN,
  'PROOF_OF_CONCEPT' => :PROOF_OF_CONCEPT,
  'FUNCTIONAL' => :FUNCTIONAL,
  'HIGH' => :HIGH,
  'NOT_DEFINED' => :NOT_DEFINED
}
REMEDIATION_LEVELS =
{
  'OFFICIAL_FIX' => :OFFICIAL_FIX,
  'TEMPORARY_FIX' => :TEMPORARY_FIX,
  'WORKAROUND' => :WORKAROUND,
  'UNAVAILABLE' => :UNAVAILABLE,
  'NOT_DEFINED' => :NOT_DEFINED
}
REPORT_CONFIDENCES =
{
  'UNCONFIRMED' => :UNCONFIRMED,
  'UNCORROBORATED' => :UNCORROBORATED,
  'CONFIRMED' => :CONFIRMED,
  'NOT_DEFINED' => :NOT_DEFINED
}
COLLATERAL_DAMAGE_POTENTIALS =
{
  'NONE' => :NONE,
  'LOW' => :LOW,
  'LOW_MEDIUM' => :LOW_MEDIUM,
  'MEDIUM_HIGH' => :MEDIUM_HIGH,
  'HIGH' => :HIGH,
  'NOT_DEFINED' => :NOT_DEFINED
}
TARGET_DISTRIBUTIONS =
{
  "NONE" => :NONE,
  "LOW" => :LOW,
  "MEDIUM" => :MEDIUM,
  "HIGH" => :HIGH,
  "NOT_DEFINED" => :NOT_DEFINED
}
CIA_REQUIREMENTS =
{
  'LOW'         => :LOW,
  'MEDIUM'      => :MEDIUM,
  'HIGH'        => :HIGH,
  'NOT_DEFINED' => :NOT_DEFINED
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version:, vector_string:, base_score:, access_vector: nil, access_Complexity: nil, authentication: nil, confidentiality_impact: nil, integrity_impact: nil, availability_impact: nil, exploitability: nil, remediation_level: nil, report_confidence: nil, temporal_score: nil, collateral_damage_potential: nil, target_distribution: nil, confidentiality_requirement: nil, integrity_requirement: nil, availability_requirement: nil, environmental_score: nil) ⇒ CVSSv2

Initializes the CVSS v2 object.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 160

def initialize(version: ,
               vector_string: ,
               base_score: ,
               access_vector: nil,
               access_Complexity: nil,
               authentication: nil,
               confidentiality_impact: nil,
               integrity_impact: nil,
               availability_impact: nil,
               exploitability: nil,
               remediation_level: nil,
               report_confidence: nil,
               temporal_score: nil,
               collateral_damage_potential: nil,
               target_distribution: nil,
               confidentiality_requirement: nil,
               integrity_requirement: nil,
               availability_requirement: nil,
               environmental_score: nil)
  @version       = version
  @vector_string = vector_string
  @base_score    = base_score

  @access_vector = access_vector
  @access_Complexity = access_Complexity
  @authentication = authentication
  @confidentiality_impact = confidentiality_impact
  @integrity_impact = integrity_impact
  @availability_impact = availability_impact
  @base_score = base_score
  @exploitability = exploitability
  @remediation_level = remediation_level
  @report_confidence = report_confidence
  @temporal_score = temporal_score
  @collateral_damage_potential = collateral_damage_potential
  @target_distribution = target_distribution
  @confidentiality_requirement = confidentiality_requirement
  @integrity_requirement = integrity_requirement
  @availability_requirement = availability_requirement
  @environmental_score = environmental_score
end

Instance Attribute Details

#access_complexity:HIGH, ... (readonly)

Returns:

  • (:HIGH, :MEDIUM, :LOW)


110
111
112
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 110

def access_complexity
  @access_complexity
end

#access_vector:NETWORK, ... (readonly)

Returns ].

Returns:

  • (:NETWORK, :ADJACENT_NETWORK, :LOCAL)

    ]



107
108
109
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 107

def access_vector
  @access_vector
end

#authentication:MULTIPLE, ... (readonly)

Returns:

  • (:MULTIPLE, :SINGLE, :NONE)


113
114
115
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 113

def authentication
  @authentication
end

#availability_impact:NONE, ... (readonly)

Returns:

  • (:NONE, :PARTIAL, :COMPLETE)


122
123
124
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 122

def availability_impact
  @availability_impact
end

#availability_requirement:NONE, ... (readonly)

Returns:

  • (:NONE, :PARTIAL, :COMPLETE)


152
153
154
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 152

def availability_requirement
  @availability_requirement
end

#base_scoreFloat (readonly)

Returns:

  • (Float)


104
105
106
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 104

def base_score
  @base_score
end

#collateral_damage_potential:NONE, ... (readonly)

Returns:

  • (:NONE, :LOW, :LOW_MEDIUM, :MEDIUM_HIGH, :HIGH, :NOT_DEFINED)


140
141
142
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 140

def collateral_damage_potential
  @collateral_damage_potential
end

#confidentiality_impact:NONE, ... (readonly)

Returns:

  • (:NONE, :PARTIAL, :COMPLETE)


116
117
118
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 116

def confidentiality_impact
  @confidentiality_impact
end

#confidentiality_requirement:NONE, ... (readonly)

Returns:

  • (:NONE, :PARTIAL, :COMPLETE)


146
147
148
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 146

def confidentiality_requirement
  @confidentiality_requirement
end

#environmental_scoreFloat? (readonly)

Returns:

  • (Float, nil)


155
156
157
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 155

def environmental_score
  @environmental_score
end

#exploitability:UNPROVEN, ... (readonly)

Returns:

  • (:UNPROVEN, :PROOF_OF_CONCEPT, :FUNCTIONAL, :HIGH, :NOT_DEFINED)


128
129
130
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 128

def exploitability
  @exploitability
end

#integrity_impact:NONE, ... (readonly)

Returns:

  • (:NONE, :PARTIAL, :COMPLETE)


119
120
121
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 119

def integrity_impact
  @integrity_impact
end

#integrity_requirement:NONE, ... (readonly)

Returns:

  • (:NONE, :PARTIAL, :COMPLETE)


149
150
151
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 149

def integrity_requirement
  @integrity_requirement
end

#remediation_level:OFFICIAL_FIX, ... (readonly)

Returns:

  • (:OFFICIAL_FIX, :TEMPORARY_FIX, :WORKAROUND, :UNAVAILABLE, :NOT_DEFINED)


131
132
133
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 131

def remediation_level
  @remediation_level
end

#report_confidence:UNCONFIRMED, ... (readonly)

Returns:

  • (:UNCONFIRMED, :UNCORROBORATED, :CONFIRMED, :NOT_DEFINED)


134
135
136
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 134

def report_confidence
  @report_confidence
end

#target_distribution:NONE, ... (readonly)

Returns:

  • (:NONE, :LOW, :MEDIUM, :HIGH, :NOT_DEFINED)


143
144
145
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 143

def target_distribution
  @target_distribution
end

#temporal_scoreFloat? (readonly)

Returns:

  • (Float, nil)


137
138
139
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 137

def temporal_score
  @temporal_score
end

#vector_stringString (readonly)

Returns:

  • (String)


101
102
103
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 101

def vector_string
  @vector_string
end

#version:"2.0" (readonly)

Returns:

  • (:"2.0")


98
99
100
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 98

def version
  @version
end

Class Method Details

.from_json(json) ⇒ Hash{Symbol => Object}

Maps the parsed JSON to a Symbol Hash for #initialize.

Parameters:

  • json (Hash{String => Object})

    The parsed JSON.

Returns:

  • (Hash{Symbol => Object})

    The Symbol Hash.

See Also:



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 213

def self.from_json(json)
  {
    version: VERSIONS.fetch(json.fetch('version')),

    vector_string: json.fetch('vectorString'),

    access_vector: if (value = json['accessVector'])
                     ACCESS_VECTORS.fetch(value)
                   end,

    access_Complexity: if (value = json['accessComplexity'])
                         ACCESS_COMPLEXITIES.fetch(value)
                       end,

    authentication: if (value = json['authentication'])
                      AUTHENTICATIONS.fetch(value)
                    end,

    confidentiality_impact: if (value = json['confidentialityImpact'])
                              CIAS.fetch(value)
                            end,

    integrity_impact: if (value = json['integrityImpact'])
                        CIAS.fetch(value)
                      end,

    availability_impact: if (value = json['availabilityImpact'])
                           CIAS.fetch(value)
                         end,

    base_score: json.fetch('baseScore'),

    exploitability: if (value = json['exploitability'])
                      EXPLOITABILITIES.fetch(value)
                    end,

    remediation_level: if (value = json['remediationLevel'])
                         REMEDIATION_LEVELS.fetch(value)
                       end,

    report_confidence: if (value = json['reportConfidence'])
                         REPORT_CONFIDENCES.fetch(value)
                       end,

    temporal_score: json['temporalScore'],

    collateral_damage_potential: if (value = json['collateralDamagePotential'])
                                   COLLATERAL_DAMAGE_POTENTIALS.fetch(value)
                                 end,

    target_distribution: if (value = json['targetDistribution'])
                           TARGET_DISTRIBUTIONS.fetch(value)
                         end,

    confidentiality_requirement: if (value = json['confidentialityRequirement'])
                                   CIA_REQUIREMENTS.fetch(value)
                                 end,

    integrity_requirement: if (value = json['integrityRequirement'])
                             CIA_REQUIREMENTS.fetch(value)
                           end,

    availability_requirement: if (value = json['availabilityRequirement'])
                                CIA_REQUIREMENTS.fetch(value)
                              end,

    environmental_score: json['environmentalScore']
  }
end

.load(json) ⇒ CVSSv2

Loads the CVSS v2 object from the parsed JSON.

Parameters:

  • json (Hash{String => Object})

    The parsed JSON.

Returns:

  • (CVSSv2)

    The CVSSv3 V2 object.



292
293
294
# File 'lib/nvd/json_feeds/schema/cvss_v2.rb', line 292

def self.load(json)
  new(**from_json(json))
end