Module: CvssSuite::Cvss3Helper
- Defined in:
- lib/cvss_suite/helpers/cvss3_helper.rb
Overview
This module includes methods which are used by the CVSS 3 classes.
Class Method Summary collapse
-
.privileges_required_score(privileges_required, scope) ⇒ Object
Since CVSS 3 the Privilege Required score depends on the selected value of the Scope metric.
-
.round_up(float) ⇒ Object
Since CVSS 3 all float values are rounded up, therefore this method is used instead of the mathematically correct method round().
Class Method Details
.privileges_required_score(privileges_required, scope) ⇒ Object
Since CVSS 3 the Privilege Required score depends on the selected value of the Scope metric. This method takes a Privilege
Required
and a Scope
metric and returns the newly calculated score.
20 21 22 23 24 25 26 27 28 |
# File 'lib/cvss_suite/helpers/cvss3_helper.rb', line 20 def self.privileges_required_score(privileges_required, scope) changed = scope.selected_value[:name] == 'Changed' privilege_score = privileges_required.score if changed privilege_score = 0.68 if privileges_required.selected_value[:name] == 'Low' privilege_score = 0.50 if privileges_required.selected_value[:name] == 'High' end privilege_score end |
.round_up(float) ⇒ Object
Since CVSS 3 all float values are rounded up, therefore this method is used instead of the mathematically correct method round().
13 14 15 |
# File 'lib/cvss_suite/helpers/cvss3_helper.rb', line 13 def self.round_up(float) float.ceil(1).to_f end |