File tree Expand file tree Collapse file tree 8 files changed +72
-12
lines changed
Expand file tree Collapse file tree 8 files changed +72
-12
lines changed Original file line number Diff line number Diff line change 22All notable changes to this project will be documented in this file.
33This project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
44
5+ ## [ 3.1.1] - 2023-10-15
6+
7+ ### Fixes
8+ * CVSS prefix is missing in v3.1.0. Fixes [ #33 ] ( https://github.com/0llirocks/cvss-suite/issues/33 )
9+
510## [ 3.1.0] - 2022-09-27
611
712### Fixes
Original file line number Diff line number Diff line change 11# CVSS-Suite, a Ruby gem to manage the CVSS vector
22#
33# Copyright (c) 2016-2022 Siemens AG
4- # Copyright (c) 2022 0llirocks
4+ # Copyright (c) 2022-2023 0llirocks
55#
66# Authors:
77# 0llirocks <http://0lli.rocks>
@@ -17,10 +17,6 @@ class Cvss
1717 # Metric of a CVSS vector.
1818 attr_reader :base , :temporal , :environmental
1919
20- ##
21- # Returns the vector itself.
22- attr_reader :vector
23-
2420 ##
2521 # Creates a new CVSS vector by a +vector+.
2622 #
@@ -80,6 +76,12 @@ def overall_score
8076 base_score
8177 end
8278
79+ ##
80+ # Returns the vector itself.
81+ def vector
82+ @vector . to_s
83+ end
84+
8385 private
8486
8587 def extract_metrics
Original file line number Diff line number Diff line change 11# CVSS-Suite, a Ruby gem to manage the CVSS vector
22#
33# Copyright (c) 2016-2022 Siemens AG
4- # Copyright (c) 2022 0llirocks
4+ # Copyright (c) 2022-2023 0llirocks
55#
66# Authors:
77# 0llirocks <http://0lli.rocks>
@@ -45,6 +45,12 @@ def environmental_score
4545 Cvss3Helper . round_up ( @environmental . score ( @base , @temporal ) )
4646 end
4747
48+ ##
49+ # Returns the vector itself.
50+ def vector
51+ "#{ CvssSuite ::CVSS_VECTOR_BEGINNINGS . find { |beginning | beginning [ :version ] == version } [ :string ] } #{ @vector } "
52+ end
53+
4854 private
4955
5056 def init_metrics
Original file line number Diff line number Diff line change 11# CVSS-Suite, a Ruby gem to manage the CVSS vector
22#
33# Copyright (c) 2019-2022 Siemens AG
4- # Copyright (c) 2022 0llirocks
4+ # Copyright (c) 2022-2023 0llirocks
55#
66# Authors:
77# 0llirocks <http://0lli.rocks>
@@ -50,6 +50,12 @@ def environmental_score
5050 Cvss31Helper . round_up ( @environmental . score ( @base , @temporal ) )
5151 end
5252
53+ ##
54+ # Returns the vector itself.
55+ def vector
56+ "#{ CvssSuite ::CVSS_VECTOR_BEGINNINGS . find { |beginning | beginning [ :version ] == version } [ :string ] } #{ @vector } "
57+ end
58+
5359 private
5460
5561 def init_metrics
Original file line number Diff line number Diff line change 11# CVSS-Suite, a Ruby gem to manage the CVSS vector
22#
33# Copyright (c) 2016-2022 Siemens AG
4- # Copyright (c) 2022 0llirocks
4+ # Copyright (c) 2022-2023 0llirocks
55#
66# Authors:
77# 0llirocks <http://0lli.rocks>
1010# See the LICENSE.md file in the top-level directory.
1111
1212module CvssSuite
13- VERSION = '3.1.0 ' . freeze
13+ VERSION = '3.1.1 ' . freeze
1414end
Original file line number Diff line number Diff line change 11# CVSS-Suite, a Ruby gem to manage the CVSS vector
22#
33# Copyright (c) 2016-2022 Siemens AG
4- # Copyright (c) 2022 0llirocks
4+ # Copyright (c) 2022-2023 0llirocks
55#
66# Authors:
77# 0llirocks <http://0lli.rocks>
137137 end
138138 end
139139 end
140+
141+ describe 'correct vector' do
142+ [
143+ [ 'AV:N/AC:L/Au:N/C:P/I:P/A:P' , 'AV:N/AC:L/Au:N/C:P/I:P/A:P' ] ,
144+ [ '(AV:N/AC:L/Au:N/C:P/I:P/A:P)' , 'AV:N/AC:L/Au:N/C:P/I:P/A:P' ]
145+ ] . each do |vector |
146+ it "'#{ vector [ 0 ] } ' is expected to return '#{ vector [ 1 ] } '" do
147+ expect ( CvssSuite . new ( vector [ 0 ] ) . vector ) . to eq ( vector [ 1 ] )
148+ end
149+ end
150+ end
140151end
Original file line number Diff line number Diff line change 11# CVSS-Suite, a Ruby gem to manage the CVSS vector
22#
33# Copyright (c) 2016-2022 Siemens AG
4- # Copyright (c) 2022 0llirocks
4+ # Copyright (c) 2022-2023 0llirocks
55#
66# Authors:
77# 0llirocks <http://0lli.rocks>
160160
161161 it_behaves_like 'a invalid cvss vector with version' , 3.0
162162 end
163+
164+ describe 'correct vector' do
165+ [
166+ [ 'CVSS:3.0/AV:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:L' , 'CVSS:3.0/AV:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:L' ] ,
167+ [ 'CVSS:3.0/A:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/AV:L' , 'CVSS:3.0/A:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/AV:L' ] ,
168+ [
169+ 'CVSS:3.0/AV:P/AC:L/PR:H/UI:N/S:C/C:N/I:L/A:H/E:X/RL:T/RC:C/CR:M/IR:L/AR:H/MAV:X/MAC:X/MPR:X/MUI:X/MS:X/MC:X/MI:X/MA:X' , # rubocop:disable Layout/LineLength
170+ 'CVSS:3.0/AV:P/AC:L/PR:H/UI:N/S:C/C:N/I:L/A:H/E:X/RL:T/RC:C/CR:M/IR:L/AR:H/MAV:X/MAC:X/MPR:X/MUI:X/MS:X/MC:X/MI:X/MA:X' # rubocop:disable Layout/LineLength
171+ ]
172+ ] . each do |vector |
173+ it "'#{ vector [ 0 ] } ' is expected to return '#{ vector [ 1 ] } '" do
174+ expect ( CvssSuite . new ( vector [ 0 ] ) . vector ) . to eq ( vector [ 1 ] )
175+ end
176+ end
177+ end
163178end
Original file line number Diff line number Diff line change 11# CVSS-Suite, a Ruby gem to manage the CVSS vector
22#
33# Copyright (c) 2016-2022 Siemens AG
4- # Copyright (c) 2022 0llirocks
4+ # Copyright (c) 2022-2023 0llirocks
55#
66# Authors:
77# 0llirocks <http://0lli.rocks>
159159
160160 it_behaves_like 'a invalid cvss vector with version' , 3.1
161161 end
162+
163+ describe 'correct vector' do
164+ [
165+ [ 'CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:L' , 'CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:L' ] ,
166+ [ 'CVSS:3.1/A:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/AV:L' , 'CVSS:3.1/A:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/AV:L' ] ,
167+ [
168+ 'CVSS:3.1/AV:P/AC:L/PR:H/UI:N/S:C/C:N/I:L/A:H/E:X/RL:T/RC:C/CR:M/IR:L/AR:H/MAV:X/MAC:X/MPR:X/MUI:X/MS:X/MC:X/MI:X/MA:X' , # rubocop:disable Layout/LineLength
169+ 'CVSS:3.1/AV:P/AC:L/PR:H/UI:N/S:C/C:N/I:L/A:H/E:X/RL:T/RC:C/CR:M/IR:L/AR:H/MAV:X/MAC:X/MPR:X/MUI:X/MS:X/MC:X/MI:X/MA:X' # rubocop:disable Layout/LineLength
170+ ]
171+ ] . each do |vector |
172+ it "'#{ vector [ 0 ] } ' is expected to return '#{ vector [ 1 ] } '" do
173+ expect ( CvssSuite . new ( vector [ 0 ] ) . vector ) . to eq ( vector [ 1 ] )
174+ end
175+ end
176+ end
162177end
You can’t perform that action at this time.
0 commit comments