class

CVSS::V3::Vector

Inherits CVSS::Vector < Comparable < Reference < Object

CVSS v3.x vector. Handles both v3.0 and v3.1 — they share metric definitions and only differ in the RoundUp algorithm and the modified impact formula.

vec = CVSS::V3::Vector.parse("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H")
vec.base_score # => 9.8
vec.severity   # => CVSS::Severity::Critical

Constants

BASE_REQUIRED = ["AV", "AC", "PR", "UI", "S", "C", "I", "A"] of ::String

The eight required base metrics. A parse failure if any is missing.

METRIC_ORDER = ["AV", "AC", "PR", "UI", "S", "C", "I", "A", "E", "RL", "RC", "CR", "IR", "AR", "MAV", "MAC", "MPR", "MUI", "MS", "MC", "MI", "MA"] of ::String

Canonical metric ordering used by to_s. Matches the FIRST calculator.

SUPPORTED_VERSIONS = {"3.0", "3.1"}

Constructors

new(av : AttackVector, ac : AttackComplexity, pr : PrivilegesRequired, ui : UserInteraction, s : Scope, c : Impact, i : Impact, a : Impact, version : String = "3.1", e : ExploitCodeMaturity | Nil = nil, rl : RemediationLevel | Nil = nil, rc : ReportConfidence | Nil = nil, cr : SecurityRequirement | Nil = nil, ir : SecurityRequirement | Nil = nil, ar : SecurityRequirement | Nil = nil, mav : ModifiedAttackVector | Nil = nil, mac : ModifiedAttackComplexity | Nil = nil, mpr : ModifiedPrivilegesRequired | Nil = nil, mui : ModifiedUserInteraction | Nil = nil, ms : ModifiedScope | Nil = nil, mc : ModifiedImpact | Nil = nil, mi : ModifiedImpact | Nil = nil, ma : ModifiedImpact | Nil = nil)
Source
parse(input : String) : Vector
Source

Class methods

parse?(input : String) : Vector | Nil

Non-raising parse — returns nil if the input is malformed.

Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

adjacent_network?
Source
base_score
Source
environmental_score
Source
environmental_severity
Source
exploitability_subscore

Exploitability subscore.

Source
hash(hasher)

See Object#hash(hasher)

impact_subscore

Impact subscore (after Scope-aware scaling).

Source
impacts_availability?
Source
impacts_confidentiality?
Source
impacts_integrity?
Source
iss

Impact Sub-Score (ISS) before scope-aware scaling — see CVSS v3.1 §7.1.

Source
local?
Source
metric_value(name : String) : String

Returns the stored short-code for a metric. Optional metrics that have not been set return "X" (the v3 NotDefined code). Raises CVSS::Error if name is not a recognised v3 metric key.

Source
network?
Source
physical?
Source
requires_privileges?
Source
requires_user_interaction?
Source
scope_changed?
Source
scope_unchanged?
Source
severity
Source
temporal_score
Source
temporal_severity
Source
to_h

Returns a Hash(String, String) of metric short-codes, in canonical order. Optional metrics are only included when set.

Source
to_s(io : IO) : Nil

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source
version
Source