cvss_rating 0.5.7 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2ccbd12f5c9e7e10efc37d8bf8169c30a2a8cae
4
- data.tar.gz: 5948fc4bbc27d6aff4a28c93174b9e4f59f420f9
3
+ metadata.gz: 12bdbf6ac619899b0be44f3d7159a11ce2ae91dd
4
+ data.tar.gz: 9a312f40d271c0afd9dda45a5742b779460b964e
5
5
  SHA512:
6
- metadata.gz: aab7c7a86f48db5a0b4e9af1e8cd1ce97e5985dca60e1935c7998aaa2642a60925788c1150886d34b2824af95a04dd03dedb2328b04e49ed972dff5806ac6d3b
7
- data.tar.gz: 782d77519ad0d104e8d88cdef42a7e206259df1f789ff4cca33b326d575e9bbb27a4300fa901e629f9b4034b6785b7ef5425c2e6351f140963488f01fc8e615d
6
+ metadata.gz: 72c1a9a832e782d140152a21fe521fc63d2cd1d96cfc149ba3b23054788ea38f71c282efab3bcc95913de7159f59b636b8538eb59cee9b41f9ccbf77effd0e9c
7
+ data.tar.gz: 8a4fd813586676f42c2954c44c80c47240716596ea2bc12513eb142e06f833467df6555ad18fe1a79f2f3fc99fce06cf6aba2eb4d7fd44a4209f31a775c663db
@@ -0,0 +1,54 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ working_directory: ~/advisory_risk_extension
5
+ parallelism: 1
6
+ shell: /bin/bash --login
7
+ environment:
8
+ CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
9
+ CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
10
+ docker:
11
+ - image: circleci/ruby:2.3.7-stretch-node-browsers
12
+ steps:
13
+ - checkout
14
+ - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
15
+ - run: sudo apt-get update
16
+ - run: sudo apt-get install cmake
17
+ - run: sudo gem install bundler-audit
18
+ - restore_cache:
19
+ keys:
20
+ - v1-dep-{{ .Branch }}-
21
+ - v1-dep-master-
22
+ - v1-dep-
23
+ - run: gem install bundler --version 1.16.4
24
+ - run: 'bundle check --path=vendor/bundle || bundle install --path=vendor/bundle
25
+ --jobs=4 --retry=3 '
26
+ - save_cache:
27
+ key: v1-dep-{{ .Branch }}-{{ epoch }}
28
+ paths:
29
+ - vendor/bundle
30
+ - ~/virtualenvs
31
+ - ~/.m2
32
+ - ~/.ivy2
33
+ - ~/.bundle
34
+ - ~/.go_workspace
35
+ - ~/.gradle
36
+ - ~/.cache/bower
37
+ - run: echo 'no database'
38
+ - run:
39
+ command: bundle exec rake test
40
+ environment:
41
+ RAILS_ENV: test
42
+ RACK_ENV: test
43
+ - run:
44
+ name: Run Bundle Audit
45
+ command: |
46
+ sudo gem install bundler-audit
47
+ bundle audit update && bundle audit check
48
+ - store_test_results:
49
+ path: /tmp/circleci-test-results
50
+ # Save artifacts
51
+ - store_artifacts:
52
+ path: /tmp/circleci-artifacts
53
+ - store_artifacts:
54
+ path: /tmp/circleci-test-results
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Cvss Rating
2
2
 
3
- [![Build Status](https://travis-ci.org/mort666/cvss_rating.svg)](https://travis-ci.org/mort666/cvss_rating)
3
+ [![CircleCI](https://circleci.com/gh/mort666/cvss_rating.svg?style=svg)](https://circleci.com/gh/mort666/cvss_rating)
4
4
 
5
5
  Implements vulnerability scoring system CVSS versions 2.0 and 3.0.
6
6
 
@@ -26,10 +26,10 @@ The following is basic usage to handle a CVSS 2.0 vector:
26
26
 
27
27
  cvs = Cvss2::Rating.new
28
28
  cvss.parse("AV:N/AC:M/Au:N/C:P/I:P/A:P")
29
-
29
+
30
30
  # Calculate overallscore
31
31
  cvss.overallscore
32
-
32
+
33
33
  The following is basic usage to handle a CVSS 3.0 vector:
34
34
 
35
35
  cvss = Cvss3::Rating.new
@@ -37,10 +37,10 @@ The following is basic usage to handle a CVSS 3.0 vector:
37
37
 
38
38
  # Calculate Base Score (returns array of score and risk level)
39
39
  cvss.cvss_base_score
40
-
40
+
41
41
  # Calculate Temporal Score (returns array of score and risk level)
42
42
  cvss.cvss_temporal_score
43
-
43
+
44
44
  # Calculate Environmental Score (returns array of score and risk level)
45
45
  cvss.cvss_environmental_score
46
46
 
@@ -55,4 +55,4 @@ Check out the unit tests for more examples of usage.
55
55
 
56
56
  Copyright (c) Stephen Kapp 2015.
57
57
 
58
- Released under the MIT License
58
+ Released under the MIT License
@@ -140,6 +140,15 @@ module Cvss3Vectors
140
140
 
141
141
  def pr
142
142
  if @sc == 'changed'
143
+ tmp = case get_key('PRIVILEGE_REQUIRED', @pr).nil? ? get_key('PRIVILEGE_REQUIRED_CHANGED', @pr) : get_key('PRIVILEGE_REQUIRED', @pr)
144
+ when 'none', 'N',
145
+ ::Cvss3::Metrics::PRIVILEGE_REQUIRED_CHANGED[:none]
146
+ when 'low', 'L'
147
+ ::Cvss3::Metrics::PRIVILEGE_REQUIRED_CHANGED[:low]
148
+ when 'high', 'H'
149
+ ::Cvss3::Metrics::PRIVILEGE_REQUIRED_CHANGED[:high]
150
+ end
151
+ @pr = tmp unless tmp.nil?
143
152
  pr = get_key('PRIVILEGE_REQUIRED_CHANGED', @pr) unless @pr.nil?
144
153
  else
145
154
  pr = get_key('PRIVILEGE_REQUIRED', @pr) unless @pr.nil?
@@ -164,8 +173,8 @@ module Cvss3Vectors
164
173
  ::Cvss3::Metrics::PRIVILEGE_REQUIRED_CHANGED[:low]
165
174
  when 'high', 'H'
166
175
  ::Cvss3::Metrics::PRIVILEGE_REQUIRED_CHANGED[:high]
167
- @pr = tmp unless tmp.nil?
168
- end
176
+ end
177
+ @pr = tmp unless tmp.nil?
169
178
  else
170
179
  self.pr = get_key('PRIVILEGE_REQUIRED', @pr).nil? ? get_key('PRIVILEGE_REQUIRED_CHANGED', @pr) : get_key('PRIVILEGE_REQUIRED', @pr)
171
180
  end
@@ -335,7 +344,7 @@ module Cvss3Vectors
335
344
  if @ms == 'changed'
336
345
  @mpr = case get_key('PRIVILEGE_REQUIRED', mpr(true)).nil? ? get_key('PRIVILEGE_REQUIRED_CHANGED', mpr(true)) : get_key('PRIVILEGE_REQUIRED', mpr(true))
337
346
  when 'none', 'N',
338
- ::Cvss3::Metrics::PRIVILEGE_REQUIRED_CHANGED[:none]
347
+ ::Cvss3::Metrics::PRIVILEGE_REQUIRED_CHANGED[:none]
339
348
  when 'low', 'L'
340
349
  ::Cvss3::Metrics::PRIVILEGE_REQUIRED_CHANGED[:low]
341
350
  when 'high', 'H'
@@ -1,5 +1,5 @@
1
1
  module Cvss2
2
2
  class Rating
3
- VERSION = "0.5.7"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
@@ -208,16 +208,27 @@ class Cvss3RatingTest < MiniTest::Test
208
208
 
209
209
  score = cvss.cvss_base_score
210
210
 
211
- assert_equal 7.7, score[0]
211
+ assert_equal 10, score[0]
212
212
 
213
- assert_equal "High", score[1]
213
+ assert_equal "Critical", score[1]
214
214
 
215
- assert_equal "U", cvss.ex
215
+ assert_equal "H", cvss.ex
216
216
 
217
217
  assert_equal "N", cvss.ui
218
218
 
219
219
  assert_equal "U", cvss.rl
220
220
 
221
+
222
+ cvss = Cvss3::Rating.new
223
+ cvss.parse('AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H')
224
+
225
+ score = cvss.cvss_base_score
226
+
227
+ assert_equal 9.1, score[0]
228
+
229
+ assert_equal "Critical", score[1]
230
+
231
+ assert_equal "H", cvss.pr
221
232
  end
222
233
 
223
234
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cvss_rating
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Kapp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-14 00:00:00.000000000 Z
11
+ date: 2018-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,8 +88,8 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
+ - ".circleci/config.yml"
91
92
  - ".gitignore"
92
- - ".travis.yml"
93
93
  - Gemfile
94
94
  - LICENSE.txt
95
95
  - README.md
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  requirements: []
126
126
  rubyforge_project:
127
- rubygems_version: 2.6.14
127
+ rubygems_version: 2.6.12
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: CVSS Risk Rating Calculation and Vector parsing
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "1.9.3"
4
- - "2.1.2"