gemsurance 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gemsurance/cli.rb +4 -0
- data/lib/gemsurance/runner.rb +23 -1
- data/lib/gemsurance/templates/output.html.erb +2 -0
- data/lib/gemsurance/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b9561a163dcf3504a3893d428cbf75ad8ee3dc5
|
4
|
+
data.tar.gz: bff5ed8f6ed9c921079f872972b3f6d3cacf3704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4ec81aa78ba0a40201bc1cd1e3c11f8a9254b453dd5bf86118a6ef1e3168eb88b3a7420126975a2523bdea7d58255c9fcf9a5543018d51e45ac915d74d44c2d
|
7
|
+
data.tar.gz: d63460b5caa5547153e2b8838dae80b5d788da603f72cf32e0dc8be4db7c383e7e9c210b898a6fef9b15ceef3915f66b485ab3c0c5c354106848808fcc68d866
|
data/lib/gemsurance/cli.rb
CHANGED
@@ -25,6 +25,10 @@ module Gemsurance
|
|
25
25
|
options[:output_file] = file
|
26
26
|
end
|
27
27
|
|
28
|
+
opts.on('--whitelist FILE', 'Read whitelist from file. Defaults to .gemsurance.yml') do |file|
|
29
|
+
options[:whitelist_file] = file
|
30
|
+
end
|
31
|
+
|
28
32
|
opts.on("--format FORMAT", "Output report to given format (html & yml available). Html by default.") do |format|
|
29
33
|
options[:formatter] = format
|
30
34
|
end
|
data/lib/gemsurance/runner.rb
CHANGED
@@ -6,6 +6,9 @@ module Gemsurance
|
|
6
6
|
@formatter = options.delete(:formatter) || :html
|
7
7
|
@output_file = options.delete(:output_file) || "gemsurance_report.#{@formatter}"
|
8
8
|
@options = options
|
9
|
+
|
10
|
+
whitelist_file = options.delete(:whitelist_file) || '.gemsurance.yml'
|
11
|
+
@whitelist = File.exist?(whitelist_file) ? YAML.load_file(whitelist_file) : false
|
9
12
|
end
|
10
13
|
|
11
14
|
def run
|
@@ -74,8 +77,15 @@ module Gemsurance
|
|
74
77
|
|
75
78
|
current_version_is_affected = (vulnerability.unaffected_versions || []).none?(¤t_version_satisfies_requirement)
|
76
79
|
current_version_isnt_patched = (vulnerability.patched_versions || []).none?(¤t_version_satisfies_requirement)
|
80
|
+
current_version_isnt_whitelisted = if (whitelisted_versions = fetch_whitelisted_versions_for(gem_info.name,
|
81
|
+
vulnerability.cve,
|
82
|
+
vulnerability.osvdb))
|
83
|
+
(whitelisted_versions || []).none?(¤t_version_satisfies_requirement)
|
84
|
+
else
|
85
|
+
true
|
86
|
+
end
|
77
87
|
|
78
|
-
if current_version_is_affected && current_version_isnt_patched
|
88
|
+
if current_version_is_affected && current_version_isnt_patched && current_version_isnt_whitelisted
|
79
89
|
gem_info.add_vulnerability!(vulnerability)
|
80
90
|
end
|
81
91
|
end
|
@@ -94,6 +104,18 @@ module Gemsurance
|
|
94
104
|
puts "Generated report #{@output_file}."
|
95
105
|
end
|
96
106
|
|
107
|
+
def fetch_whitelisted_versions_for(gem, cve = nil, osvdb = nil)
|
108
|
+
if @whitelist && (whitelisted_gem = @whitelist[gem])
|
109
|
+
if cve
|
110
|
+
whitelisted_gem["CVE-#{cve}"]
|
111
|
+
elsif osvdb
|
112
|
+
whitelisted_gem["OSVDB-#{osvdb}"]
|
113
|
+
else
|
114
|
+
# There are is no CVE or OSVDB for this vulnerability
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
97
119
|
def resolved_definition
|
98
120
|
# Need to temporarily unfrozen Bundler (when the gems have been installed with --deployment option e.g.)
|
99
121
|
if Bundler.settings[:frozen]
|
data/lib/gemsurance/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemsurance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Kessler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: 1.8.11
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.5.2
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Your Gem Insurance Policy
|