nvd_feed_api 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +5 -8
- data/.rubocop.yml +8 -4
- data/.tool-versions +1 -1
- data/Gemfile +11 -5
- data/Gemfile.lock +89 -35
- data/Rakefile +2 -0
- data/bin/nvd_feed_api +1 -0
- data/bin/nvd_feed_api_console +1 -0
- data/lib/nvd_feed_api/feed.rb +2 -0
- data/lib/nvd_feed_api/meta.rb +2 -0
- data/lib/nvd_feed_api/version.rb +3 -1
- data/lib/nvd_feed_api.rb +5 -7
- data/nvd_feed_api.gemspec +4 -2
- data/pages/CHANGELOG.md +8 -1
- data/test/test_nvd_feed_api.rb +20 -7
- metadata +7 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0365df5462570fa4b9483e27ef5d6b7edf48cde8599c199932b86bda75c7790d
|
4
|
+
data.tar.gz: 52c270979c88f7154edd2c06f9dcec28c9fccffd3ff0606f6bda817a2f6ffd6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aceb9c1aa76e74ad7d87329900417abccd5c01f47a9fb76cdddf870e00654257dacf9506eb3b87e4cb9148a2ae2829191e2357ae56f4af4cd35b904073bb89fe
|
7
|
+
data.tar.gz: cfb064247356ab4f559d6b50cb997a7f332ab26f1172dafab8baf2ab5d30c204da7594a438b710e671204633cc77c6ca66a1c5f1056f2da721a69760b65faab8
|
data/.gitlab-ci.yml
CHANGED
@@ -15,7 +15,8 @@ before_script:
|
|
15
15
|
# install make, gcc for building gem native extension (commonmarker)
|
16
16
|
# libc-dev for musl-dev dependency (stdlib.h) needed by gcc
|
17
17
|
- apk --no-cache add coreutils git make gcc libc-dev
|
18
|
-
- bundle
|
18
|
+
- bundle config set path 'vendor' # Set dependencies install dir to ./vendor/ruby
|
19
|
+
- bundle install -j $(nproc) # Install dependencies into ./vendor/ruby
|
19
20
|
- bundle exec rake install # install the gem
|
20
21
|
|
21
22
|
# Anchors: https://docs.gitlab.com/ee/ci/yaml/README.html#anchors
|
@@ -25,17 +26,13 @@ before_script:
|
|
25
26
|
- bundle exec rubocop
|
26
27
|
- bundle exec rake test
|
27
28
|
|
28
|
-
|
29
|
-
# <<: *job_definition
|
30
|
-
# image: ruby:2.4-alpine
|
31
|
-
|
32
|
-
test:3.1:
|
29
|
+
test:3.4:
|
33
30
|
<<: *job_definition
|
34
|
-
image: ruby:3.
|
31
|
+
image: ruby:3.4-alpine
|
35
32
|
|
36
33
|
pages:
|
37
34
|
stage: deploy
|
38
|
-
image: ruby:3.
|
35
|
+
image: ruby:3.4-alpine
|
39
36
|
script:
|
40
37
|
- bundle exec yard doc
|
41
38
|
- mkdir public
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion:
|
2
|
+
TargetRubyVersion: 3.1
|
3
3
|
NewCops: enable
|
4
|
+
SuggestExtensions: false
|
5
|
+
|
6
|
+
plugins:
|
7
|
+
- rubocop-minitest
|
4
8
|
|
5
9
|
Layout/HashAlignment:
|
6
10
|
EnforcedHashRocketStyle: table
|
@@ -33,6 +37,9 @@ Metrics/MethodLength:
|
|
33
37
|
Metrics/PerceivedComplexity:
|
34
38
|
Enabled: false
|
35
39
|
|
40
|
+
Minitest/MultipleAssertions:
|
41
|
+
Enabled: false
|
42
|
+
|
36
43
|
Naming/VariableName:
|
37
44
|
EnforcedStyle: snake_case
|
38
45
|
|
@@ -42,9 +49,6 @@ Security/JSONLoad:
|
|
42
49
|
Style/CaseLikeIf:
|
43
50
|
Enabled: true
|
44
51
|
|
45
|
-
Style/FrozenStringLiteralComment:
|
46
|
-
EnforcedStyle: never
|
47
|
-
|
48
52
|
Style/PerlBackrefs:
|
49
53
|
AutoCorrect: false
|
50
54
|
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.1
|
1
|
+
ruby 3.4.1
|
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
@@ -13,15 +15,19 @@ group :development, :install do
|
|
13
15
|
end
|
14
16
|
|
15
17
|
group :development, :test do
|
16
|
-
gem 'minitest', '~> 5.
|
17
|
-
gem 'rake', '~> 13.
|
18
|
+
gem 'minitest', '~> 5.25'
|
19
|
+
gem 'rake', '~> 13.2'
|
18
20
|
end
|
19
21
|
|
20
22
|
group :development, :lint do
|
21
|
-
gem 'rubocop', '~> 1.
|
23
|
+
gem 'rubocop', '~> 1.71'
|
24
|
+
gem 'rubocop-minitest', '~> 0.36'
|
22
25
|
end
|
23
26
|
|
24
27
|
group :development, :docs do
|
25
|
-
gem 'commonmarker', '~> 0
|
26
|
-
gem '
|
28
|
+
gem 'commonmarker', '~> 2.0' # for markdown support in YARD
|
29
|
+
gem 'logger', '< 2.0'
|
30
|
+
# gem 'yard', ['>= 0.9.27', '< 0.10']
|
31
|
+
# https://github.com/lsegal/yard/issues/1528
|
32
|
+
gem 'yard', github: 'ParadoxV5/yard', ref: '9e869c940859570b07b81c5eadd6070e76f6291e', branch: 'commonmarker-1.0'
|
27
33
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/ParadoxV5/yard.git
|
3
|
+
revision: 9e869c940859570b07b81c5eadd6070e76f6291e
|
4
|
+
ref: 9e869c940859570b07b81c5eadd6070e76f6291e
|
5
|
+
branch: commonmarker-1.0
|
6
|
+
specs:
|
7
|
+
yard (0.9.36)
|
8
|
+
|
1
9
|
PATH
|
2
10
|
remote: .
|
3
11
|
specs:
|
4
|
-
nvd_feed_api (0.
|
12
|
+
nvd_feed_api (0.5.0)
|
5
13
|
archive-zip (~> 0.11)
|
6
14
|
nokogiri (~> 1.11)
|
7
15
|
oj (>= 3.7.8, < 4)
|
@@ -11,54 +19,100 @@ GEM
|
|
11
19
|
specs:
|
12
20
|
archive-zip (0.12.0)
|
13
21
|
io-like (~> 0.3.0)
|
14
|
-
ast (2.4.
|
15
|
-
|
22
|
+
ast (2.4.3)
|
23
|
+
bigdecimal (3.1.9)
|
24
|
+
commonmarker (2.2.0)
|
25
|
+
rb_sys (~> 0.9)
|
26
|
+
commonmarker (2.2.0-aarch64-linux)
|
27
|
+
commonmarker (2.2.0-aarch64-linux-musl)
|
28
|
+
commonmarker (2.2.0-arm64-darwin)
|
29
|
+
commonmarker (2.2.0-x86_64-darwin)
|
30
|
+
commonmarker (2.2.0-x86_64-linux)
|
31
|
+
commonmarker (2.2.0-x86_64-linux-musl)
|
16
32
|
io-like (0.3.1)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
33
|
+
json (2.10.2)
|
34
|
+
language_server-protocol (3.17.0.4)
|
35
|
+
lint_roller (1.1.0)
|
36
|
+
logger (1.6.6)
|
37
|
+
minitest (5.25.5)
|
38
|
+
nokogiri (1.18.6-aarch64-linux-gnu)
|
39
|
+
racc (~> 1.4)
|
40
|
+
nokogiri (1.18.6-aarch64-linux-musl)
|
41
|
+
racc (~> 1.4)
|
42
|
+
nokogiri (1.18.6-arm-linux-gnu)
|
43
|
+
racc (~> 1.4)
|
44
|
+
nokogiri (1.18.6-arm-linux-musl)
|
45
|
+
racc (~> 1.4)
|
46
|
+
nokogiri (1.18.6-arm64-darwin)
|
47
|
+
racc (~> 1.4)
|
48
|
+
nokogiri (1.18.6-x86_64-darwin)
|
49
|
+
racc (~> 1.4)
|
50
|
+
nokogiri (1.18.6-x86_64-linux-gnu)
|
51
|
+
racc (~> 1.4)
|
52
|
+
nokogiri (1.18.6-x86_64-linux-musl)
|
21
53
|
racc (~> 1.4)
|
22
|
-
oj (3.
|
23
|
-
|
24
|
-
|
54
|
+
oj (3.16.10)
|
55
|
+
bigdecimal (>= 3.0)
|
56
|
+
ostruct (>= 0.2)
|
57
|
+
ostruct (0.6.1)
|
58
|
+
parallel (1.26.3)
|
59
|
+
parser (3.3.7.3)
|
25
60
|
ast (~> 2.4.1)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
61
|
+
racc
|
62
|
+
prism (1.4.0)
|
63
|
+
racc (1.8.1)
|
64
|
+
rainbow (3.1.1)
|
65
|
+
rake (13.2.1)
|
66
|
+
rake-compiler-dock (1.9.1)
|
67
|
+
rb_sys (0.9.111)
|
68
|
+
rake-compiler-dock (= 1.9.1)
|
69
|
+
regexp_parser (2.10.0)
|
70
|
+
rubocop (1.75.1)
|
71
|
+
json (~> 2.3)
|
72
|
+
language_server-protocol (~> 3.17.0.2)
|
73
|
+
lint_roller (~> 1.1.0)
|
32
74
|
parallel (~> 1.10)
|
33
|
-
parser (>= 3.
|
75
|
+
parser (>= 3.3.0.2)
|
34
76
|
rainbow (>= 2.2.2, < 4.0)
|
35
|
-
regexp_parser (>=
|
36
|
-
|
37
|
-
rubocop-ast (>= 1.15.1, < 2.0)
|
77
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
78
|
+
rubocop-ast (>= 1.43.0, < 2.0)
|
38
79
|
ruby-progressbar (~> 1.7)
|
39
|
-
unicode-display_width (>=
|
40
|
-
rubocop-ast (1.
|
41
|
-
parser (>= 3.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
80
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
81
|
+
rubocop-ast (1.43.0)
|
82
|
+
parser (>= 3.3.7.2)
|
83
|
+
prism (~> 1.4)
|
84
|
+
rubocop-minitest (0.37.1)
|
85
|
+
lint_roller (~> 1.1)
|
86
|
+
rubocop (>= 1.72.1, < 2.0)
|
87
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
88
|
+
ruby-progressbar (1.13.0)
|
89
|
+
unicode-display_width (3.1.4)
|
90
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
91
|
+
unicode-emoji (4.0.4)
|
47
92
|
|
48
93
|
PLATFORMS
|
49
|
-
|
94
|
+
aarch64-linux-gnu
|
95
|
+
aarch64-linux-musl
|
96
|
+
arm-linux-gnu
|
97
|
+
arm-linux-musl
|
98
|
+
arm64-darwin
|
99
|
+
x86_64-darwin
|
100
|
+
x86_64-linux-gnu
|
101
|
+
x86_64-linux-musl
|
50
102
|
|
51
103
|
DEPENDENCIES
|
52
104
|
archive-zip (~> 0.11)
|
53
105
|
bundler (~> 2.1)
|
54
|
-
commonmarker (~> 0
|
55
|
-
|
106
|
+
commonmarker (~> 2.0)
|
107
|
+
logger (< 2.0)
|
108
|
+
minitest (~> 5.25)
|
56
109
|
nokogiri (~> 1.11)
|
57
110
|
nvd_feed_api!
|
58
111
|
oj (>= 3.7.8, < 4)
|
59
|
-
rake (~> 13.
|
60
|
-
rubocop (~> 1.
|
61
|
-
|
112
|
+
rake (~> 13.2)
|
113
|
+
rubocop (~> 1.71)
|
114
|
+
rubocop-minitest (~> 0.36)
|
115
|
+
yard!
|
62
116
|
|
63
117
|
BUNDLED WITH
|
64
|
-
2.
|
118
|
+
2.6.2
|
data/Rakefile
CHANGED
data/bin/nvd_feed_api
CHANGED
data/bin/nvd_feed_api_console
CHANGED
data/lib/nvd_feed_api/feed.rb
CHANGED
data/lib/nvd_feed_api/meta.rb
CHANGED
data/lib/nvd_feed_api/version.rb
CHANGED
data/lib/nvd_feed_api.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# @author Alexandre ZANNI <alexandre.zanni@engineer.com>
|
2
4
|
|
3
5
|
# Ruby internal
|
@@ -18,7 +20,7 @@ require 'nvd_feed_api/feed'
|
|
18
20
|
# scraper.feeds("CVE-2007")
|
19
21
|
# cve2007, cve2015 = scraper.feeds("CVE-2007", "CVE-2015")
|
20
22
|
class NVDFeedScraper
|
21
|
-
BASE = 'https://nvd.nist.gov'
|
23
|
+
BASE = 'https://nvd.nist.gov'
|
22
24
|
# The NVD url where is located the data feeds.
|
23
25
|
URL = "#{BASE}/vuln/data-feeds".freeze
|
24
26
|
# Load constants
|
@@ -132,11 +134,7 @@ class NVDFeedScraper
|
|
132
134
|
def available_feeds
|
133
135
|
raise 'call scrap method before using available_feeds method' if @feeds.nil?
|
134
136
|
|
135
|
-
|
136
|
-
@feeds.each do |feed| # feed is an objet
|
137
|
-
feed_names.push(feed.name)
|
138
|
-
end
|
139
|
-
feed_names
|
137
|
+
@feeds.map(&:name)
|
140
138
|
end
|
141
139
|
|
142
140
|
# Search for CVE in all year feeds.
|
@@ -211,7 +209,7 @@ class NVDFeedScraper
|
|
211
209
|
|
212
210
|
matched_feeds = feeds_to_match.intersection(feed_names)
|
213
211
|
# and now that the intersection is done remove those virtual feeds and add CVE-2002 instead if needed
|
214
|
-
|
212
|
+
if matched_feeds.intersect?(virtual_feeds.to_set)
|
215
213
|
matched_feeds.subtract(virtual_feeds)
|
216
214
|
matched_feeds.add('CVE-2002')
|
217
215
|
end
|
data/nvd_feed_api.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'lib/nvd_feed_api/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |s|
|
@@ -13,7 +15,6 @@ Gem::Specification.new do |s|
|
|
13
15
|
|
14
16
|
s.files = `git ls-files`.split("\n")
|
15
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
16
|
-
s.test_files = s.files.grep(%r{^(test)/})
|
17
18
|
s.require_paths = ['lib']
|
18
19
|
|
19
20
|
s.metadata = {
|
@@ -24,10 +25,11 @@ Gem::Specification.new do |s|
|
|
24
25
|
'homepage_uri' => 'https://noraj.gitlab.io/nvd_api/',
|
25
26
|
'source_code_uri' => 'https://gitlab.com/noraj/nvd_api/tree/master',
|
26
27
|
'wiki_uri' => 'https://gitlab.com/noraj/nvd_api/wikis/home',
|
28
|
+
'funding_uri' => 'https://github.com/sponsors/noraj',
|
27
29
|
'rubygems_mfa_required' => 'true'
|
28
30
|
}
|
29
31
|
|
30
|
-
s.required_ruby_version = ['>=
|
32
|
+
s.required_ruby_version = ['>= 3.1.0', '< 4.0']
|
31
33
|
|
32
34
|
s.add_dependency('archive-zip', '~> 0.11')
|
33
35
|
s.add_dependency('nokogiri', '~> 1.11')
|
data/pages/CHANGELOG.md
CHANGED
data/test/test_nvd_feed_api.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'minitest/autorun'
|
2
4
|
require 'nvd_feed_api'
|
3
5
|
require 'date'
|
@@ -78,7 +80,7 @@ class NVDAPITest < Minitest::Test
|
|
78
80
|
f2017, f2016, f_modified = @s.feeds('CVE-2017', 'CVE-2016', 'CVE-Modified')
|
79
81
|
# one arg
|
80
82
|
# can't use assert_instance_of because there is no boolean class
|
81
|
-
|
83
|
+
assert_includes(['TrueClass', 'FalseClass'], @s.update_feeds(f2017).class.to_s, "update_feeds doesn't return a boolean")
|
82
84
|
# two args
|
83
85
|
assert_instance_of(Array, @s.update_feeds(f2017, f2016), "update_feeds doesn't return an array")
|
84
86
|
refute_empty(@s.update_feeds(f2017, f2016), 'update_feeds returns an empty array')
|
@@ -90,7 +92,7 @@ class NVDAPITest < Minitest::Test
|
|
90
92
|
err = assert_raises(RuntimeError) do
|
91
93
|
@s.update_feeds(1)
|
92
94
|
end
|
93
|
-
assert_equal(
|
95
|
+
assert_equal('the provided argument 1 is not a Feed or an Array', err.message)
|
94
96
|
## empty array
|
95
97
|
assert_empty(@s.update_feeds([]))
|
96
98
|
end
|
@@ -102,6 +104,7 @@ class NVDAPITest < Minitest::Test
|
|
102
104
|
assert_instance_of(String, default_val, "default_storage_location doesn't return a string")
|
103
105
|
# check new value
|
104
106
|
new_val = '/srv/downloads/'
|
107
|
+
|
105
108
|
assert_equal(new_val, NVDFeedScraper::Feed.default_storage_location = new_val, 'the new value was not set properly')
|
106
109
|
# put the default value back / restore context
|
107
110
|
NVDFeedScraper::Feed.default_storage_location = default_val
|
@@ -137,10 +140,12 @@ class NVDAPITest < Minitest::Test
|
|
137
140
|
# Test json_file
|
138
141
|
assert_nil(f.json_file)
|
139
142
|
f.json_pull
|
143
|
+
|
140
144
|
assert_instance_of(String, f.json_file, "json_file doesn't return a string")
|
141
145
|
refute_empty(f.json_file, 'json_file is empty')
|
142
146
|
# Test meta (after json_pull)
|
143
147
|
f.meta_pull
|
148
|
+
|
144
149
|
assert_instance_of(NVDFeedScraper::Meta, f.meta, "meta doesn't return a Meta object")
|
145
150
|
|
146
151
|
# Test data (require json_pull)
|
@@ -161,6 +166,7 @@ class NVDAPITest < Minitest::Test
|
|
161
166
|
def test_feed_available_cves
|
162
167
|
f = @s.feeds('CVE-2011')
|
163
168
|
f.json_pull
|
169
|
+
|
164
170
|
assert_instance_of(Array, f.available_cves, "available_cves doesn't return an array")
|
165
171
|
refute_empty(f.available_cves, 'available_cves returns an empty array')
|
166
172
|
end
|
@@ -199,6 +205,7 @@ class NVDAPITest < Minitest::Test
|
|
199
205
|
def test_feed_download_gz
|
200
206
|
f = @s.feeds('CVE-2013')
|
201
207
|
return_value = f.download_gz
|
208
|
+
|
202
209
|
assert_instance_of(String, return_value, "download_gz doesn't return a string")
|
203
210
|
refute_empty(return_value, 'download_gz returns an empty string')
|
204
211
|
assert(File.file?(return_value), 'download_gz returns an unexisting file')
|
@@ -207,6 +214,7 @@ class NVDAPITest < Minitest::Test
|
|
207
214
|
def test_feed_download_zip
|
208
215
|
f = @s.feeds('CVE-2003')
|
209
216
|
return_value = f.download_zip
|
217
|
+
|
210
218
|
assert_instance_of(String, return_value, "download_zip doesn't return a string")
|
211
219
|
refute_empty(return_value, 'download_zip returns an empty string')
|
212
220
|
assert(File.file?(return_value), 'download_zip returns an unexisting file')
|
@@ -215,6 +223,7 @@ class NVDAPITest < Minitest::Test
|
|
215
223
|
def test_feed_json_pull
|
216
224
|
f = @s.feeds('CVE-2004')
|
217
225
|
return_value = f.json_pull
|
226
|
+
|
218
227
|
assert_instance_of(String, return_value, "json_pull doesn't return a string")
|
219
228
|
refute_empty(return_value, 'json_pull returns an empty string')
|
220
229
|
assert(File.file?(return_value), 'json_pull returns an unexisting file')
|
@@ -222,6 +231,7 @@ class NVDAPITest < Minitest::Test
|
|
222
231
|
|
223
232
|
def test_feed_meta_pull
|
224
233
|
f = @s.feeds('CVE-2005')
|
234
|
+
|
225
235
|
assert_instance_of(NVDFeedScraper::Meta, f.meta_pull, "meta_pull doesn't return a Meta object")
|
226
236
|
end
|
227
237
|
|
@@ -231,7 +241,7 @@ class NVDAPITest < Minitest::Test
|
|
231
241
|
f_new = @s.feeds('CVE-2006')
|
232
242
|
# Right arg
|
233
243
|
# can't use assert_instance_of because there is no boolean class
|
234
|
-
|
244
|
+
assert_includes(['TrueClass', 'FalseClass'], f.update!(f_new).class.to_s, "update! doesn't return a boolean")
|
235
245
|
# Bad arg
|
236
246
|
err = assert_raises(RuntimeError) do
|
237
247
|
f.update!('bad_arg')
|
@@ -241,18 +251,21 @@ class NVDAPITest < Minitest::Test
|
|
241
251
|
|
242
252
|
def test_meta_parse_noarg
|
243
253
|
m = NVDFeedScraper::Meta.new('https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2015.meta')
|
254
|
+
|
244
255
|
assert_equal(0, m.parse, 'parse method return nothing')
|
245
256
|
end
|
246
257
|
|
247
258
|
def test_meta_parse_witharg
|
248
259
|
m = NVDFeedScraper::Meta.new
|
249
260
|
meta_url = 'https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2015.meta'
|
261
|
+
|
250
262
|
assert_equal(0, m.parse(meta_url), 'parse method return nothing')
|
251
263
|
end
|
252
264
|
|
253
265
|
def test_meta_url_setter
|
254
266
|
m = NVDFeedScraper::Meta.new
|
255
267
|
meta_url = 'https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2015.meta'
|
268
|
+
|
256
269
|
assert_equal(meta_url, m.url = meta_url, 'the meta URL is not set correctly')
|
257
270
|
end
|
258
271
|
|
@@ -263,22 +276,22 @@ class NVDAPITest < Minitest::Test
|
|
263
276
|
m.parse
|
264
277
|
# Test gz_size
|
265
278
|
assert_instance_of(String, m.gz_size, "Meta gz_size method doesn't return a string")
|
266
|
-
|
279
|
+
assert_match(/[0-9]+/, m.gz_size, 'Meta gz_size is not an integer')
|
267
280
|
# Test last_modified_date
|
268
281
|
assert_instance_of(String, m.last_modified_date, "Meta last_modified_date method doesn't return a string")
|
269
282
|
## Date and time of day for calendar date (extended) '%FT%T%:z'
|
270
283
|
assert(Date.rfc3339(m.last_modified_date), 'Meta last_modified_date is not a rfc3339 date')
|
271
284
|
# Test sha256
|
272
285
|
assert_instance_of(String, m.sha256, "Meta sha256 method doesn't return a string")
|
273
|
-
|
286
|
+
assert_match(/[0-9A-F]{64}/, m.sha256, 'Meta sha256 is not a sha256 string matching /[0-9A-F]{64}/')
|
274
287
|
# Test size
|
275
288
|
assert_instance_of(String, m.size, "Meta size method doesn't return a string")
|
276
|
-
|
289
|
+
assert_match(/[0-9]+/, m.size, 'Meta size is not an integer')
|
277
290
|
# Test url
|
278
291
|
assert_instance_of(String, m.url, "Meta url method doesn't return a string")
|
279
292
|
assert_equal(meta_url, m.url, 'The Meta url was modified')
|
280
293
|
# Test zip_size
|
281
294
|
assert_instance_of(String, m.zip_size, "Meta zip_size method doesn't return a string")
|
282
|
-
|
295
|
+
assert_match(/[0-9]+/, m.zip_size, 'Meta zip_size is not an integer')
|
283
296
|
end
|
284
297
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nvd_feed_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre ZANNI
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-30 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: archive-zip
|
@@ -107,8 +106,8 @@ metadata:
|
|
107
106
|
homepage_uri: https://noraj.gitlab.io/nvd_api/
|
108
107
|
source_code_uri: https://gitlab.com/noraj/nvd_api/tree/master
|
109
108
|
wiki_uri: https://gitlab.com/noraj/nvd_api/wikis/home
|
109
|
+
funding_uri: https://github.com/sponsors/noraj
|
110
110
|
rubygems_mfa_required: 'true'
|
111
|
-
post_install_message:
|
112
111
|
rdoc_options: []
|
113
112
|
require_paths:
|
114
113
|
- lib
|
@@ -116,19 +115,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
115
|
requirements:
|
117
116
|
- - ">="
|
118
117
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
118
|
+
version: 3.1.0
|
120
119
|
- - "<"
|
121
120
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
121
|
+
version: '4.0'
|
123
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
123
|
requirements:
|
125
124
|
- - ">="
|
126
125
|
- !ruby/object:Gem::Version
|
127
126
|
version: '0'
|
128
127
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
130
|
-
signing_key:
|
128
|
+
rubygems_version: 3.6.2
|
131
129
|
specification_version: 4
|
132
130
|
summary: API for NVD CVE feeds
|
133
|
-
test_files:
|
134
|
-
- test/test_nvd_feed_api.rb
|
131
|
+
test_files: []
|