Sha256: 715007169da026c21452156047ee6e65dce3bfbfe6da074923112a6fe76200a7

Contents?: true

Size: 697 Bytes

Versions: 7

Compression:

Stored size: 697 Bytes

Contents

##
# This module includes methods which are used by the CVSS 3 classes.

module Cvss3Helper

  ##
  # Since CVSS 3 the Privilege Required score depends on the selected choice of the Scope metric.
  # This method takes a +Privilege+ +Required+ and a +Scope+ metric and returns the newly calculated score.

  def self.privileges_required_score(privileges_required, scope)
    changed =  scope.selected_choice[:name] == 'Changed'
    privilege_score = privileges_required.score
    if changed
      privilege_score = 0.68 if privileges_required.selected_choice[:name] == 'Low'
      privilege_score = 0.50 if privileges_required.selected_choice[:name] == 'High'
    end
    privilege_score
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cvss-suite-1.0.6 lib/cvss_suite/helpers/cvss3_helper.rb
cvss-suite-1.0.5 lib/cvss_suite/helpers/cvss3_helper.rb
cvss-suite-1.0.4 lib/cvss_suite/helpers/cvss3_helper.rb
cvss-suite-1.0.3 lib/cvss_suite/helpers/cvss3_helper.rb
cvss-suite-1.0.2 lib/cvss_suite/helpers/cvss3_helper.rb
cvss-suite-1.0.1 lib/cvss_suite/helpers/cvss3_helper.rb
cvss-suite-1.0.0 lib/cvss_suite/helpers/cvss3_helper.rb